回覆列表
  • 1 # 手機使用者86660411892

    import java.util.Scanner;

    public class Test {

    public static void main(String[] args) {

    System.out.print("Please input the month to check:");

    int month = new Scanner(System.in).nextInt();

    if (month <= 0 || month > 12) {

    System.out.println("Error! month must be between 1 and 12!");

    } else if (month <= 3) {

    System.out.println("Month " + month + " is in Spring!");

    } else if (month <= 6) {

    System.out.println("Month " + month + " is in Summer!");

    } else if (month <= 9) {

    System.out.println("Month " + month + " is in Autumn!");

    } else {

    System.out.println("Month " + month + " is in Winter!");

    }

    }

    }

    --------------------

    Please input the month to check:7

    Month 7 is in Autumn!

  • 中秋節和大豐收的關聯?
  • 為什麼化完妝臉上出油?