Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int i,j,n,count;
- cout<<"Enter no. of elements:";
- cin>>n;
- int set[n];
- cout<<"\nEnter the elements:";
- for(i=0; i<n; i++)
- {
- cin>>set[i];
- }
- int flag[n]={0};
- cout<<"\nRepeated Numbers with their frequency:";
- for(i=0; i<n; i++)
- {
- count=0;
- if(flag[i]!=1)
- {
- for(j=0; j<n; j++)
- {
- if(set[i]==set[j])
- {
- count++;
- flag[j]=1;
- }
- }
- if(count>1)
- {
- cout<<"\n"<<set[i]<<" -> "<<count;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment