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
What is c standard library?
Explain the ternary tree?
When would you use a pointer to a function?
When should you use a type cast?
find out largest elemant of diagonalmatrix
What is use of #include in c?
What is the most efficient way to store flag values?
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
Is javascript based on c?
What does it mean when the linker says that _end is undefined?
Why is sprintf unsafe?
What does c mean before a date?
What is sizeof c?
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
What is strcpy() function?