Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int max, a, n, min;
- int main()
- {
- cin >> n >> max;
- min = max;
- for(int i = 1; i < n; i++)
- {
- cin >> a;
- if( n == 1)
- {
- max = a,
- min = a;
- }
- if(a > max) max = a;
- if(a < min) min = a;
- }
- cout << min << " " << max;
- return 0;
- }
Add Comment
Please, Sign In to add comment