• + 0 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;

        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;
        }
    
    
    
    }