{
SumOddEven(A,n)             //A is array and n is size of array
{
    int count, sum;
    for(int i = 1; i<=n; i++)  {
    sum_even=0;
    sum_odd=0;
                    for(int j = i; j<=n; j++)  {
               if (A[j] Mod 2 == 0)                  //check if number is even
                                        sum_even=sum_even+A[j]    //Sum even numbers
                                    else
                                        sum_odd=sum_odd+A[j]      //Sum odd numbers
              }
    cout<<sum_even;
    cout<<sum_odd;
            }
}

Under Linux you can use the time command to give you the amount of time taken to run a command. To review the manual entry for time use:
man time

TIME(1)                       Linux User's Manual                      TIME(1)

NAME
       time - time a simple command or give resource usage

SYNOPSIS
       time [options] command [arguments...]

DESCRIPTION
       The  time  command  runs  the  specified program command with the given
       arguments.  When command finishes, time writes a  message  to  standard
       error  giving  timing statistics about this program run.  These statis‐
       tics consist of (i) the elapsed real time between invocation and termi‐

Compute how many times the if statement is executed.

Did you face a problem or an error in the code given?

If you did, post the error noted here for us to provide our perspective on the problem.

If you want to get an understanding on measuring time complexity, you can refer to the post i have made earlier that relates to this problem at the below link:-
Click Here

I suppose it has a run time linear to the size of the input n. I'm no expert on computational complexity, but I've heard some of the concepts.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.