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 can arithmetic operations not be performed on void pointers?
What is a structural principle?
What are the difference between a free-standing and a hosted environment?
p*=(++q)++*--p when p=q=1 while(q<=6)
Explain setjmp()?
What is the difference between #include and #include 'file' ?
How many types of operator or there in c?
Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.
What is the stack in c?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
What is difference between Structure and Unions?
Write a c program to demonstrate character and string constants?
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
What is the importance of c in your views?
How can I remove the leading spaces from a string?