第六题变形

/**
 *  需求:基本练习,输入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");

}
        
    }
    
}

 

 

posted on 2017-09-26 22:23  技术小子2025  阅读(127)  评论(0)    收藏  举报

导航