class freq
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("entre the number of digits");
int n=Integer.parseInt(br.readLine());
int f=0;
System.out.println("entre the numbers");
int a[]=new int[n];
for(int i=0;i<n;i++)
{
a[i]=Integer.parseInt(br.readLine());
}
for(int i=0;i<n;i++)
{
int c=0;
int c1=0;
f=a[i];
for(int j=i-1;j>=0;j--)
{
if(a[i]==a[j])
{
c=c+1;
}
}
if(c==0)
{
for(int j=i;j<n;j++)
{
if(a[i]==a[j])
{
c1=c1+1;
}
}
System.out.println("frequency of"+a[i]+"is ="+c1);
}
}
}
}
No comments:
Post a Comment
HAY THAKYOU FOE VISIT