Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. Use of while loop & sentinel value to read and calculate statistics of a series of integer numbers.
  2. Write a program that prompts the user to enter an integer, -9999 to stop. (-9999 is the sentinel value).
  3. Read the valid data (i.e. not sentinel) using a while-loop one at a time and exit the loop once the sentinel value is entered. At the end of the program, you need to print the following statistics: count, average (double type), max and min values. Must avoid (a) division by zero, and (b) integer division that causes loss of accuracy in calculating average value.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement