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 =]