input N integers (ask from the user how many numbers he/she wants to input) determine and print the sum of all numbers, the average of all numbers, how many odd numbers were inputted, how many even numbers were entered and how many zeroes inputted
void main(){ cout<<"enter the number of integers you want to enter: "; cin>>N; for (int i=0; i<N; i++) { & cout<<"enter a number: "; & cin>>p; & sum += p; & if (odd(p)) ++o; & else ++e; & if (p==0) ++z; & p++; } cout<<"The sum is "<<sum<<"\nThe average is "<<sum/N<<"\nThe number of odds: "<<o<<"\nThe number of evens: "<<e<<"\n"; system("pause"); }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment