Best Answer

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

Q: C program to find sum of odd numbers in an array?

Write your answer...

Submit

Still have questions?

Continue Learning about Math & Arithmetic

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

Related questions

for(int i = 1; i < 100; i+=2) { System.out.println(i); }

void f (int* a, int len) { if (!a) return;for (int i=0; i<len; ++i) { if (a[i]%2) { printf ("%d is odd\n", a[i]); } else { printf ("%d is even\n", a[i]); } }

int array[10] = {...}; for (int i = 0; i < 10; ++i) { if (i % 2 == 0) array[i] += 5; else array[i] -= 10; }

Reference: cprogramming-bd.com/c_page4.aspx#ODD%20 Numbers

The procedure is the same whether the number is even or odd. There is no separate procedure for odd numbers.

All nonzero numbers have factors. Some factors are odd numbers. 3 is an odd factor of 12.

Look for odd squares. Multiplying odd numbers results in an odd product.

#include

The answer is an odd number.

Shell problems are programs that can be run to find out information about numbers. The problem can help find an even or odd number, or what the sum of a cube is.

No. An odd plus an odd is even, and an even plus an odd is odd. Thus, you will always end up with an odd number if you add only three odd numbers together, and 50 is even.

you cross the numbers out from back to front