Minimum and Maximum
Time limit1sMemory limit256 MB
Read N integers and print the smallest and the largest separated by a space.
- Level
Easy1 of 10
- Topics
- Array
- Solved
- No attempts yet
Problem
You are given integers. Write a program that finds the smallest and the largest of them.
Input
The first line contains the number of integers ().
The second line contains the integers, separated by spaces. Each integer is at least and at most .
Output
Print the smallest and the largest of the given integers on the first line, separated by a single space.