Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 66cf8f1

Browse files
add 2520
1 parent 41bead2 commit 66cf8f1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _2520 {
4+
public static class Solution1 {
5+
public int countDigits(int num) {
6+
int original = num;
7+
int sum = 0;
8+
while (num != 0) {
9+
int digit = num % 10;
10+
num /= 10;
11+
if (original % digit == 0) {
12+
sum++;
13+
}
14+
}
15+
return sum;
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)