Advertisement
Josif_tepe

Untitled

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