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
how do you execute a c program in unix.
Where static variables are stored in memory in c?
What is wrong with this statement? Myname = 'robin';
What are operators in c?
Write a program to use switch statement.
Why void is used in c?
What are types of functions?
What is the meaning of 2d in c?
Why can arithmetic operations not be performed on void pointers?
What are variables c?
What is a void * in c?
Is c call by value?
Tell us the use of fflush() function in c language?
what do you mean by enumeration constant?
What is the difference between far and near in c?