aboutsummaryrefslogtreecommitdiff
path: root/challenge-142/lubos-kolouch/java/ch-1.java
blob: 98298d5b3f0dc949a4577981992587814368f81c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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));
  }
}