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
List the different types of c tokens?
In c programming language, how many parameters can be passed to a function ?
Can you mix old-style and new-style function syntax?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
Define C in your own Language.
Why isn't any of this standardized in c? Any real program has to do some of these things.
What are the different types of pointers used in c language?
can anyone suggest some site name..where i can get some good data structure puzzles???
Why pointers are used in c?
How does sizeof know array size?
how to capitalise first letter of each word in a given string?
Compare interpreters and compilers.
write a programe to accept any two number and check the following condition using goto state ment.if a>b,print a & find whether it is even or odd and then print.and a
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What is "Hungarian Notation"?