AnkitWebLogic

C - Input 10 numbers and find sum of odd and even numbers

Q. WAP to input 10 numbers in array and find sum of odd and even numbers separately 1

void main()
{
    int a[10], i, odd=0, even=0;
    clrscr();
    printf("Enter 10 Numbers: ");
    for(i=0;i<=9;i++)
        scanf("%d",&a[i]);

    for(i=0;i<=9;i++)
    {
        if(a[i]%2==0)
        {
            even = even + a[i];
        }
        else
        {
            odd = odd + a[i];
        }
    }
    printf("\nSum of odd no = %d",odd);
    printf("\nSum of even no = %d",even);
    getch();
}
Enter 10 Numbers: 1 2 3 4 5 6 7 8 9 10
Sum of odd no = 25
Sum of even no = 30