Guest User

Untitled

a guest
Sep 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int N,min,max;
  8. cin >> N;
  9. min = N;
  10. max = N;
  11.  
  12. int i,x;
  13. for (i = 1; i <= N; ++i){
  14. cin >> x;
  15.  
  16. if ( x < min ){
  17. min = x;
  18. }
  19. if (x > max){
  20. max = x;
  21. }
  22. }
  23.  
  24. cout << min <<" "<< max;
  25.  
  26. return 0;
  27. }
Add Comment
Please, Sign In to add comment