Eight-Day Temperature Range
Whetcode Weather prints a one-line plain-English blurb under every city's forecast card. The copy desk has written "a settled stretch" for Portland and now needs a number to back it up before it ships: the swing of the period, from its coolest day to its warmest.
The same line runs under every city card, so it has to work for a winter week in Fairbanks as well as a summer one in Portland, and for cards showing different numbers of days.
Task: Print the range of the daily highs, in whole degrees. Every reading is a whole number, so the answer must print without a decimal point.
Input
One line holding the daily high temperatures in degrees Fahrenheit, separated by single spaces, in calendar order. Each reading is a whole number and may be negative.
Output
One line holding the range in whole degrees - 16, never 16.0.
Example:
Input:
68 72 75 70 74 69 81 65
Output:
16
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in