https://www.hackerrank.com/challenges/find-digits/problem
#include <stdio.h>
int main()
{
unsigned long long int t;
scanf("%llu",&t);
while(t--)
{
unsigned long long int n,c=0,temp;
scanf("%llu",&n);
temp=n;
while(n>0)
{
int digit=(n%10);
if(digit > 0)
if(temp%digit == 0)
c++;
n=n/10;
}
printf("%llu\n",c);
}
}
No comments:
Post a Comment