CodeMIRAI
0 XP

Minimum and maximum

Medium +50 XP Solved

The first number is n, followed by n whole numbers. Print the minimum and the maximum, separated by a space.

Input
5
4 9 1 7 3
Expected output
1 9
Input
1
42
Expected output
42 42
Show a hint

Read the first number into both min and max, then compare each following number.

Show a solution
C++
Loading the editor…
Run the tests to check your solution.