answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

void main()

{

int n, a[10, evensum=0, oddsum=0, i;

printf("\n Enter the number of values");

scanf("\n %d", &n);

printf("\n Enter %d number of values", n);

for(i=0; i<n; i++)

scanf("\n %d", &a[i]);

while(i<n)

{

if(a[i]%2==0)

evensum=evensum + a[i];

else

oddsum=oddsum + a[i];

}

printf("\n Odd sum = %d", oddsum);

printf("\n Even sum = %d", evensum);

getch();

}

Hopefully, is that correct, anyone out there.... I am a beginner and this is my homework, please help me correct the mistaks if you know them...

User Avatar

Wiki User

12y ago

Still curious? Ask our experts.

Chat with our AI personalities

BlakeBlake
As your older brother, I've been where you are—maybe not exactly, but close enough.
Chat with Blake
RossRoss
Every question is just a happy little opportunity.
Chat with Ross
MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine

Add your answer:

Earn +20 pts
Q: C program to find sum of odd numbers in an array?
Write your answer...
Submit
Still have questions?
magnify glass
imp