Advertisement
skb50bd

Repeated Digits

Apr 4th, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int n, a[10]={0}, t , i;
  5.     printf("Enter The Number: ");
  6.     scanf("%d",&n);
  7.     for(t=n ; t!=0 ; t/=10)
  8.         for(i=0 ; i<10 ; i++)
  9.             if(t%10==i)
  10.                 a[i]++;
  11.     for(i=0 ; i<10 ; i++)
  12.         if(a[i]>1)
  13.             printf("%d: %d times\n",i,a[i]);
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement