Advertisement
Josif_tepe

Untitled

Mar 10th, 2021
100
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 <algorithm>
  3. using namespace std;
  4.  
  5. int min(int a, int b) {
  6.     if(a < b) {
  7.         return a;
  8.     }
  9.     else {
  10.         return b;
  11.     }
  12. }
  13. int main()
  14. {
  15.     int n;
  16.     cin >> n;
  17.     int niza[n];
  18.     for(int i = 0; i < n; i++) {
  19.         cin >> niza[i];
  20.     }
  21.     int najmal = 2000000000;
  22.     for(int i = 0; i < n; i++) {
  23.         najmal = min(najmal, niza[i]);
  24.     }
  25.     cout << najmal << endl;
  26.     return 0;
  27. }
  28. // 5
  29. // 4 3 1 2 5
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement