Read an integer N. This number indicates how many values the array will have.
Then, read N integers (one per line) and store them in an array.
Finally, find the largest and smallest number in the array in a single pass, and display them on the same line.
Hints:
for loop to read the data and store it in the array.for loop that goes through the array only once and at each step checks if the current element is greater or smaller than those saved.An integer N, followed by N integers, one per line.
Print on a single line the maximum and minimum using the following exact format:
Max:X Min:Y
Input:
5
3
7
1
9
5
Output:
Max:9 Min:1