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