Advertisement
Josif_tepe

Untitled

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