updated readme
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// Author: Rodney Shaghoulian
|
||||
// Github: github.com/rshaghoulian
|
||||
// HackerRank: hackerrank.com/rshaghoulian
|
||||
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Solution {
|
||||
public static void main(String[] args) {
|
||||
Scanner scan = new Scanner(System.in);
|
||||
int testcases = scan.nextInt();
|
||||
while (testcases-- > 0) {
|
||||
int num = scan.nextInt();
|
||||
System.out.println(findDigits(num));
|
||||
}
|
||||
scan.close();
|
||||
}
|
||||
|
||||
private static int findDigits(int num) {
|
||||
int count = 0;
|
||||
int n = num;
|
||||
while (n > 0) {
|
||||
int digit = n % 10;
|
||||
if (digit != 0 && num % digit == 0) {
|
||||
count++;
|
||||
}
|
||||
n /= 10;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user