Write a C Program to check occurence of digit in a given number. Here’s simple Program to check occurence of digit in a given number in C Programming Language.
Below is the source code for C Program to check occurence of digit in a given number which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
/* C Program to check occurence of digit in a given number */
#include<stdio.h>
#include<conio.h>
int main()
{
int num,i,n,k,num1;
printf("Enter any number :: ");
scanf("%d",&num);
n=num;
i=0;
printf("\nEnter the digit :: ");
scanf("%d",&num1);
while(n!=0)
{
k=n%10;
n=n/10;
if(k==num1)
{
i++;
}
}
printf("\nThe occurrence of %d is %d times",num1,i);
return 0;
}
OUTPUT : :
Enter any number :: 443454
Enter the digit :: 4
The occurrence of 4 is 4 times
Above is the source code for C Program to find the roots of quadratic equation which is successfully compiled and run on Windows System.The Output of the program is shown above .
Below is the source code for C Program to check occurence of digit in a given number which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
OUTPUT : :
Above is the source code for C Program to find the roots of quadratic equation which is successfully compiled and run on Windows System.The Output of the program is shown above .
need an explanation for this answer? contact us directly to get an explanation for this answer