LulzRose

Thing 2

Oct 2nd, 2018
319
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. In many cases when we want to find the average of a set of numbers, we throw away the extreme values, either because they
  2.  
  3. Are not representative (i.e. a 0 on a quiz because the person was absent)
  4. Are presumed to be errors in measurement (in a bunch of 80o temperatures there is a 180o reading – someone used a magnifier to focus the sun’s rays…)
  5.  
  6. Write a complete program to read a series of numbers from the keyboard. Use an end-of-input signal value of –99. Calculate and print the average of the numbers between 32 and 212. Any number below 32 or above 212 should not be included in the average calculations, but you should keep a count of them and print that at the end of the program. A run of the program should resemble the following:
  7.  
  8. Enter a number (-99 to quit): 22
  9. Enter a number (-99 to quit): 44
  10. ...
  11. Enter a number (-99 to quit): -99
  12.  
  13. Average is: 45.45
  14.  
  15. There were 3 extreme values
Advertisement
Add Comment
Please, Sign In to add comment