Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int arrSize;
- cin >> arrSize;
- int arr[arrSize] = {0};
- for(int k = 0; k < arrSize; ++k)
- {
- cin >> arr[k];
- }
- int most_Frequent_num = 0;
- int print_index = 0;
- for(int i = 0; i <= arrSize; ++i)
- {
- int counter_Frequent_loop = 0;
- for(int j = 0; j <= arrSize; ++j)
- {
- if(arr[i] == arr[j])
- {
- counter_Frequent_loop++;
- }
- if(most_Frequent_num < counter_Frequent_loop)
- {
- most_Frequent_num = counter_Frequent_loop;
- print_index = arr[i];
- }
- }
- }
- cout << print_index << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement