Current streak:
10 days
Longest streak:
10 days
Less
More
public class Solution {
public static int countDigits(int n){
// Write your code here.
//simply assign value into another variable and init a counter
int x = n,cnt=0;
while(x!=0){
int rem = x%10;
//check reather than rem doesn't equal to 0 and divide the given number
if(rem!=0 && n%rem==0)
cnt++;
x/=10;
}
//simply return counter
return cnt;
}
}