-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDivisibleByALL.java
More file actions
39 lines (32 loc) · 879 Bytes
/
Copy pathDivisibleByALL.java
File metadata and controls
39 lines (32 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package day11;
public class DivisibleByALL {
package day11;
import java.util.*;
public class divisibleByALL {
static int fact(int n) {
int factorial = 1;
for (int i = 1; i <= n; i++) {
factorial *= i;
}
return factorial;
}
static boolean isStrong(int n) {
int sum = 0;
int original = n;
int count=0;
int length=String.valueOf(original).length();
while (n != 0) {
int digit = n % 10;
if(original%digit==0) {
count++;
}
n=n/10;
}
return count == length ;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
System.out.println(isStrong(n));
}
}