{
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
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.