-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest4.java
More file actions
38 lines (35 loc) · 772 Bytes
/
test4.java
File metadata and controls
38 lines (35 loc) · 772 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
import java.util.*;
public class test4 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO 自动生成的方法存根
int n;
Scanner reader=new Scanner(System.in);
System.out.print("请输入一个整数:");
n=reader.nextInt();
if(n%30==0){
System.out.print("该数能被2,3,5,6,10,15,30整除。");
}
else if(n%15==0){
System.out.print("该数能被3,5,15整除。");
}
else if(n%10==0){
System.out.print("该数能被2,5,10整除。");
}
else if(n%6==0){
System.out.print("该数能被2,3,6整除。");
}
else if(n%5==0){
System.out.print("该数能被5整除。");
}
else if(n%3==0){
System.out.print("该数能被3整除。");
}
else if(n%2==0){
System.out.print("该数能被2整除。");
}
else {System.out.print("不能这些数整除。");}
}
}