Homework E3

Due dates

This assignment must be submitted to the Moodle submission page for Homework E3 by 11:00 PM on Tuesday, 13 September. And, yes, that is the day after the Labor Day holiday.

The assignment

In this assignment you will ask the user to enter a series of integers. Your program will count the number of integers the user enters. When the user enters input that is neither white space or a digit, your program should stop reading integers and print out, as a decimal number, the average of all the integers that have been entered.

If no integers are entered, or if an integer out of the range of 32-bit numbers is entered; your program is allowed to crash and burn.

An example

ECE 209 Homework E3
J Dean Brock

Enter some integers (end with something that ain't)
  209  212
1000000000  -2011

  23 skidoo
The average is 199999686.600

Important notes

Your program does not need to store all the integers that are typed in. It only needs to keep up with the number of integers that have been entered and their sum. Do not use an array to solve this problem.

Test the return of scanf to end your loop. As long as scanf returns 1, your program should continue to process numbers.

You can Google for programs similar to this one. Do you put any uncredited code into your program.