# Thread: HELP with Total number of even and odd numbers (not sum)

1. ## HELP with Total number of even and odd numbers (not sum)

This is my HW question:

Write a program that will ask the user to input 10 non-negative numbers. Your program should reject the number if it is negative, and make the user type a non-negative number. Your program should then compute and report the following statistics about the numbers entered: sum of the numbers, average of the numbers, # of odd numbers entered, # of even numbers entered.

I need help getting the total number of odd and even numbers this is what I have ...help please?

Code:
```#include< iostream>
#include <cmath>
Using namespace std;

int main ()

{

int a,b,c,d,e,f,g,h,i,j;
int sum,avg,even,odd;

cout << “Input ten non-negative numbers: ”
cin >> a >> b >> c >> d >> e >> f >> g >> h >> i >> j;

sum=a+b+c+d+e+f+g+h+i+j;
avg= sum/10

if ( a,b,c,d,e,f,g,h,i,j % 2 == 0 )
cin>>even<<endl;
else
cin>> odd<< endl;

if (a,b,c,d,e,f,g,h,I,j>=0)
cout <<sum<<" " <<avg<< " "<<odd << " "<<even;

else (a,b,c,d,e,f,g,h,i,j <0)

cout << "You entered a negative number! ";

return 0;
}```
I Greatly Appreciate Your Help =]

2. You're approacing this in the wrong way..(aside from syntax problems).
Code:
```Run a loop..for ten times.
Ask the user to input a number.
If the entered number is -ve, do not increment the counter variable, show an error.
If it is +ve,
add it to the sum..and increment the counter.
if it is even, add 1 to the even counter...else add 1 to the odd one.
Average = Sum / 10