Advertisement
Guest User

Untitled

a guest
Sep 7th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cmath>
  4.  
  5. using namespace std;
  6.  
  7. main () {
  8.  
  9. int n;
  10.  
  11. cin>>n;
  12.  
  13. int minN=INT_MAX;
  14. int maxN=INT_MIN;
  15.  
  16.  
  17. for(int a=0 ;a<n ;a++){
  18. int compare;
  19. cin >> compare;
  20.  
  21. if(compare<minN){
  22. minN=compare;
  23. } else if (compare>maxN) {
  24. maxN=compare;
  25. }
  26. }
  27.  
  28. cout << minN << " " << maxN;
  29.  
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement