{
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;
}
}
jaiop
0
Newbie Poster
Recommended Answers
Jump to PostUnder 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 timeTIME(1) Linux User's Manual TIME(1) NAME time - time a simple command or give resource usage SYNOPSIS …
All 4 Replies
rch1231
169
Posting Shark
Gribouillis
1,391
Programming Explorer
Team Colleague
Dean_williams
0
Professional poster
dannyniu
0
Newbie Poster
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.