Advertisement
Guest User

Minim Maxim

a guest
Apr 26th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. ///wellcode.ro
  3. using namespace std;
  4. /**
  5. 5
  6. 2 7 9 1 3 */
  7. int main()
  8. {
  9.     int n, x, maxx = -1, minn = 51, i;  ///am declarat minimul si maximul
  10.     cin >> n;
  11.     for( i = 1; i <= n; i++ ){
  12.         cin >> x;
  13.         if( x > maxx ){   /// actualizez maximul
  14.             maxx = x;
  15.         }
  16.         if( x < minn ){    /// actualizez minimul
  17.             minn = x;
  18.         }
  19.     }
  20.     cout << minn << " " << maxx;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement