#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...
Chat with our AI personalities
for(int i = 1; i < 100; i+=2) { System.out.println(i); }
The procedure is the same whether the number is even or odd. There is no separate procedure for odd numbers.
The answer is an odd number.
you cross the numbers out from back to front
15 and 13