- import java.util.Scanner;
- public class OP321 {
- static Scanner input = new Scanner(System.in);
- public static void main(String[] args) {
- test();
- test();
- test();
- test();
- }
-
- public static void test() {
- System.out.println("enter an integer:");
- int a=input.nextInt();
- if(a%2==0&&a%3==0&&a%6==0)
- {
- System.out.println(a+"是2、3、6的倍數");
- }
- else if(a%2==0&&a%3==0)
- {
- System.out.println(a+"是2,3的倍數");
-
- }
- else if(a%2==0)
- {
-
-
- System.out.println(a+"是2的倍數");
-
- }
- else if(a%3==0)
- {
-
-
- System.out.println(a+"是3的倍數");
-
- }
-
-
-
- else
- {
- System.out.println(a+"不是2、3、6的倍數");
- }
- }
- }
複製代碼 |