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
What do mean by network ?
How can you restore a redirected standard stream?
What is c basic?
What is the difference between null pointer and wild pointer?
Why is structure padding done in c?
Is using exit() the same as using return?
Write a program to implement queue.
what is the difference between 123 and 0123 in c?
Explain what are binary trees?
What is the condition that is applied with ?: Operator?
What is #define size in c?
Which header file should you include if you are to develop a function which can accept variable number of arguments?
what is use of malloc and calloc?
What is return type in c?
How does selection sort work in c?