Advertisement
Guest User

Untitled

a guest
Sep 7th, 2019
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 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.         double compareD;
  19.         cin >> compareD;
  20.  
  21.         int compare=int(compareD);
  22.  
  23.         if(compare<minN){
  24.             minN=compare;
  25.         } else if (compare>maxN) {
  26.             maxN=compare;
  27.         }
  28.     }
  29.  
  30.     cout << minN << " " << maxN;
  31.  
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement