Advertisement
Josif_tepe

Untitled

Dec 4th, 2022
497
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.  
  3. using namespace std;
  4.  
  5. float najgolem_broj(int n, float niza[]) {
  6.     float najgolem = niza[0];
  7.     for(int i = 0; i < n; i++) {
  8.         if(niza[i] > najgolem) {
  9.             najgolem = niza[i];
  10.         }
  11.     }
  12.     return najgolem;
  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 << najgolem_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