Advertisement
dllbridge

Untitled

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