1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import java.util.Scanner;
public class A04 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner (System.in);
System.out.println( "请输入一个整数:" );
int number=input.nextInt();
if (number% 5 == 0 &&number% 3 == 0 ){
System.out.println( "该数是3和5的倍数!" );
} else if (number% 3 == 0 ){
System.out.println( "该数是3的倍数!" );
} else if (number% 5 == 0 ){
System.out.println( "该数是5的倍数!" );
} else {
System.out.println( "该数不是3和5的倍数" );
}
}
} |
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1420155