diff options
Diffstat (limited to 'challenge-142/lubos-kolouch/java/ch-1.java')
| -rw-r--r-- | challenge-142/lubos-kolouch/java/ch-1.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/challenge-142/lubos-kolouch/java/ch-1.java b/challenge-142/lubos-kolouch/java/ch-1.java new file mode 100644 index 0000000000..98298d5b3f --- /dev/null +++ b/challenge-142/lubos-kolouch/java/ch-1.java @@ -0,0 +1,16 @@ +public class Main { + static int countDivisorsWithLastDigit(int m, int n) { + int count = 0; + for (int i = 1; i <= m; i++) { + if (m % i == 0 && i % 10 == n) { + count++; + } + } + return count; + } + + public static void main(String[] args) { + System.out.println(countDivisorsWithLastDigit(24, 2)); + System.out.println(countDivisorsWithLastDigit(30, 5)); + } +} |
