Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- void printFrequency(int n)
- {
- int num;
- printf("Enter the digit: ");
- scanf("%d",&num);
- int count=0;
- int x=n;
- while(n!=0)
- {
- int rem=n%10;
- if(rem==num)
- {
- count++;
- }
- n=n/10;
- }
- printf("%d has %d times in %d",num,count,x);
- }
- int main()
- {
- int n;
- printf("Enter a number: ");
- scanf("%d",&n);
- printFrequency(n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement