write a program to find the frequency of a number

Answer Posted / md abdul khader

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int n,a[100],b[100],i,test=0,j,count=0;
cout<<"The size of your digit : ";
cin>>n;
cout<<"Enter the digits of your number : "<<endl;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(j=0;j<=9;j++)
{
for(i=0;i<n;i++)
{
if(a[i]==j)
count++;
}
b[j]=count;
count=0;
}
cout<<"Your number is : ";
for(i=0;i<n;i++)
{
cout<<a[i];
}
cout<<"\nDesired Output is : "<<endl;
for(i=0;i<=9;i++)
{
cout<<i<<" : ";
while(test<b[i])
{
cout<<"* ";
test++;
}
test=0;
cout<<endl;
}
getch();
}

Is This Answer Correct ?    17 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why can arithmetic operations not be performed on void pointers?

583


What is a structural principle?

634


What are the difference between a free-standing and a hosted environment?

735


p*=(++q)++*--p when p=q=1 while(q<=6)

1264


Explain setjmp()?

649






What is the difference between #include and #include 'file' ?

602


How many types of operator or there in c?

593


Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.

1011


What is the stack in c?

712


how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?

1501


What is difference between Structure and Unions?

632


Write a c program to demonstrate character and string constants?

1676


hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm

1627


What is the importance of c in your views?

586


How can I remove the leading spaces from a string?

625