Advertisement
Josif_tepe

Untitled

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