logo CodeStepByStep logo

evenAverage

Language/Type: C++ basics user input
Related Links:

Write C++ code that prompts the user for nonzero integers, and then prints the average of all even numbers typed. (When the user types 0, stop asking for input.) You may assume that the user types at least one even integer. The following is an example output from one run of your code:

Integer? 1
Integer? 3
Integer? 2
Integer? 6
Integer? 4
Integer? 10
Integer? 9
Integer? 0
Average: 5.5
Bare code. Write a fragment of C++ code as described, without any main function or heading around your code.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.