We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public class Solution {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = scanner.nextInt();
int number;
String napis;
int divDigit=0;
for(int i =0;i<n;i++){
number = scanner.nextInt();
napis = String.valueOf(number);
String[] arrayString= napis.split("");
int[] array = new int[napis.length()];
for(int j=0;j<napis.length();j++){
array[j]=Integer.parseInt(arrayString[j]);
if(array[j]!=0&&number%array[j]==0) divDigit++;
}
System.out.println(divDigit);
divDigit=0;
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Find Digits
You are viewing a single comment's thread. Return to all comments →
java15:
import java.util.*;
public class Solution { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int number; String napis; int divDigit=0;