Advertisement
dllbridge

Untitled

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