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:

int? 1
int? 3
int? 2
int? 6
int? 4
int? 10
int? 9
int? 0
Average: 5.5
Bare code: Write a fragment of C# code as described, without any class or function/method 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.