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
write a proram to reverse the string using switch case?
What is the size of enum in c?
What is masking?
What is the most efficient way to count the number of bits which are set in an integer?
What is static identifier?
What is identifier in c?
The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none
Why static is used in c?
#include
how to create duplicate link list using C???
How can I call a function with an argument list built up at run time?
How can I convert a number to a string?
How do you print only part of a string?
Can you think of a logic behind the game minesweeper.
Difference between MAC vs. IP Addressing