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
why programs in c are running with out #include
Explain how do you convert strings to numbers in c?
Explain goto?
Write a program to swap two numbers without using third variable?
What is character constants?
hi friends how r u as soon in satyam my interview is start but i m very confusued ta wat i do plz help me frndz wat can i do plz tell me some question and answers related with "C" which r asked in the interview .
How do you print an address?
What does it mean when the linker says that _end is undefined?
How many levels of indirection in pointers can you have in a single declaration?
Explain what is the difference between far and near ?
What are c identifiers?
Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)
How can you return multiple values from a function?
What is the scope of static variable in c?
What is 2 d array in c?