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
How can you be sure that a program follows the ANSI C standard?
How is a null pointer different from a dangling pointer?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
What is the difference between %d and %i?
Is calloc better than malloc?
Explain the difference between exit() and _exit() function?
Why is event driven programming or procedural programming, better within specific scenario?
how to write a c program to print list of fruits in alpabetical order?
Can a function argument have default value?
What is a void pointer in c?
What is the symbol indicated the c-preprocessor?
Explain what is a stream?
please can any one suggest me best useful video tutorials on c i am science graduate.please help me.u can email me to sas29@in.com
Define circular linked list.
What is the difference between struct and typedef struct in c?