The Day's Extremes
Northwind Health keeps a weather station on the roof of its cold-store. Staff record two figures at the end of each day for the temperature log: how cold it got and how warm it got. The station hands over every reading it took, in the order it took them, and marks none of them as a high or a low.
Task: Print the day's lowest reading, then its highest.
Input
The first line holds a single integer n, the number of readings. Each of the next n lines holds one temperature in degrees Fahrenheit: a decimal number that may be negative. There is always at least one reading.
Output
Two lines. The lowest reading on the first line, the highest on the second. Round each to the nearest tenth and always show that one decimal digit, so a reading of 72 prints as 72.0 and a reading of 68.57 prints as 68.6.
Example:
Input:
4
68.5
72.0
65.2
70.1
Output:
65.2
72.0
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