Advertisement
dllbridge

Untitled

Oct 15th, 2022
771
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1.  
  2. #include   <iostream>
  3. using namespace std;
  4.  
  5.  
  6. long long int  m,                                  
  7.                a,
  8.                n,
  9.                f;
  10.          
  11.  
  12.  
  13. ////////////////////////////////////////////////////
  14. int main()                                        //
  15. {
  16.    
  17.     cin >> n;                    
  18.     cin >> m;
  19.    
  20.     f = m;
  21.    
  22.     for(int i = 1; i < n; i++)
  23.     {
  24.         cin >> a;
  25.        
  26.        
  27.         if( n == 1)
  28.         {
  29.             m = a,
  30.             f = a;
  31.         }
  32.        
  33.         if(a > m) m = a;
  34.         if(a < f) f = a;
  35.        
  36.     }
  37.    
  38.     cout << f << " " << m;
  39.    
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement