zoukankan      html  css  js  c++  java
  • Java编程语言基础 第三章 季节if用法

    package cn.save;

    import java.util.Scanner;

    public class Dome2 {
    public static void main(String[] args){
    Scanner input = new Scanner(System.in);
    System.out.println("请输入数字:");
    int month = input.nextInt();
    String season ="";

    if(month>12 || month<1){//保障输入的是1-12月
    System.out.println("输出月份不合理:");

    }else {
    //冬季 11 12 1 春季 2 3 4 夏季 5 6 7 秋季 8 9 10
    if(month==1 || month>=11){
    season ="冬天";
    }else if(month<4 && month>=2){
    season ="春天";
    }else if(month<8 && month>=4){
    season ="夏天";
    }else if(month<11 && month>=8){
    season ="秋天";
    }
    System.out.println(season);
    }
    }
    }

  • 相关阅读:
    CodeForces
    hdu4003 树形dp
    hdu2196
    poj2486
    hdu1502 树形dp入门题
    cf 686D
    bzoj2763 分层图
    hdu4424 并查集+贪心+思维
    poj1734 最小环+输出路径
    集训题解1
  • 原文地址:https://www.cnblogs.com/ls1783047205/p/9328729.html
Copyright © 2011-2022 走看看