Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n;
- cout << "vvedite kol-vo elementov: ";
- cin >> n;
- int* mass = new int[n];
- for (int i = 0; i < n; i++)
- {
- cout << "[" << i << "] = ";
- cin >> mass[i];
- }
- int maxcount = 0;
- int element;
- for ( int i = 0; i < n; i++)
- {
- int count = 0;
- for (int j = i; j < n; j++)
- {
- if (mass[i] == mass[j])
- {
- count++;
- }
- if (maxcount < count)
- {
- maxcount = count;
- element = i;
- }
- }
- }
- cout << endl << mass[element] << endl;
- delete[] mass;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement