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 is stack , heap ,code segment,and data segment
In a switch statement, what will happen if a break statement is omitted?
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 .
What is unsigned int in c?
When a c file is executed there are many files that are automatically opened what are they files?
What was noalias and what ever happened to it?
Explain about block scope in c?
WRITE A PROGRAM TO MERGE TWO SORTED ARRAY USING MERGE SORT TECHNIQUE..
What is oops c?
Is it cc or c in a letter?
Explain indirection?
What is printf () in c?
what is the function of pragma directive in c?
How can I read and write comma-delimited text?
What does emoji p mean?