第六题变形
/** * 需求:基本练习,输入1-12来查询,Month; * 思路:if-else if-else 语句; * * 步骤:略 */ import java.util.Scanner; public class Demo_1{ public static void main(String[] arge) { Scanner input = new Scanner(System.in); System.out.println("please enter two number: "); int Month = input.nextInt();//输入一个数字 if(Month>=3 && Month<=5){ System.out.println("The month is Spring"); } else if(Month>=6 && Month<=8){ System.out.println("The month is Summer"); } else if(Month>=9 && Month<=11){ System.out.println("The month is Fall"); } else if(Month==12 || Month>=1 && Month<=2){ System.out.println("The month is winter"); } else { System.out.println("Mistake"); } } }
![]()
This moment will nap, you will have a dream; but this moment study, you will interpret a dream.

浙公网安备 33010602011771号