/*A company wishes to encode its data.The data is in the form of number.
They wish to encode the data with respect to specific digit.
They wish to count the number of times the specific digit reoccurs in the
given data so that they can encode the data accordingly.
Write an algorithm to find the count of the specific digit in the given data.
Input:
572378233 3 71428754 4
output:
3 2 */
#include<stdio.h>
int main()
{
int num,digit,rem,count=0;
scanf("%d%d",&num,&digit);//572378233 3
while(num!=0)
{
rem=num%10;//3
if(rem==digit)//T
count++;//1
num=num/10;//57237823
}
printf("%d",count);
}
To embed this program on your website, copy the following code and paste it into your website's HTML: