Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- unsigned n,i,v[1000],nr,j,maxi=0;
- cout<<"n=";cin>>n;
- for (i=0;i<n;i++)
- cin>>v[i];
- for (i=0;i<n-1;i++)
- {
- nr=1;
- for (j=i+1;j<n;j++)
- if (v[i]==v[j])
- nr++;
- if (nr>maxi)
- maxi=nr;
- }
- for (i=0;i<n;i++)
- {
- nr=1;
- for (j=i+1;j<n;j++)
- if (v[i]==v[j])
- nr++;
- if (nr==maxi)
- cout<<v[i]<<' ';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement