write a program to find the frequency of a number
Answer Posted / pratik roy
#include<stdio.h>
#include<conio.h>
void freq(int ,int ,int );
int main()
{
int a,key,count,i;
printf("Enter the elements\n");
scanf("%d",&a);
printf("Enter the element whose frequency is to be determined\n");
scanf("%d",&key);
freq(a,key,0);
getch();
return 0;
}
void freq(int num,int key,int count)
{
int samkey,i;
i=num/10;
if(i!=0)
{
samkey = num%10;
if(samkey == key ) {count++; freq(num,key,count);}
else
{
num=num/10;
freq(num,key,count);
}
}
printf("%d",count);
}
| Is This Answer Correct ? | 4 Yes | 10 No |
Post New Answer View All Answers
Why ca not I do something like this?
#include
What are the types of data files?
What's a good way to check for "close enough" floating-point equality?
Why enum is used in c?
Which programming language is best for getting job 2020?
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
How can I do peek and poke in c?
Write the control statements in C language
What are the benefits of organizational structure?
If null and 0 are equivalent as null pointer constants, which should I use?
What is function and its example?
Explain what are header files and explain what are its uses in c programming?
What is void c?
What are examples of structures?