Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how do you execute a c program in unix.

1112


Where static variables are stored in memory in c?

1001


What is wrong with this statement? Myname = 'robin';

1325


What are operators in c?

1022


Write a program to use switch statement.

1129


Why void is used in c?

1017


What are types of functions?

1037


What is the meaning of 2d in c?

1123


Why can arithmetic operations not be performed on void pointers?

1042


What are variables c?

1051


What is a void * in c?

1073


Is c call by value?

1014


Tell us the use of fflush() function in c language?

1138


what do you mean by enumeration constant?

1011


What is the difference between far and near in c?

1066