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
Does c have an equivalent to pascals with statement?
Can you write a programmer for FACTORIAL using recursion?
FILE PROGRAMMING
How can I avoid the abort, retry, fail messages?
How can you allocate arrays or structures bigger than 64K?
How can I send mail from within a c program?
Lists the benefits of c programming language?
What do you mean by Recursion Function?
What Is The Difference Between Null And Void Pointer?
How do c compilers work?
What is header file definition?
Explain the bubble sort algorithm.
Write a c program to build a heap method using Pointer to function and pointer to structure ?
What is pragma c?
Explain the array representation of a binary tree in C.