普朗克麻辣鸡

导航

 

public class year {
    public static void main(String arg[]){
        Scanner a=new Scanner(System.in);
        System.out.print("请输入一个年份:");
       int b=a.nextInt();
        System.out.print("请输入一个月份:");
       int f=a.nextInt();
        if (b%4==0&&b%100!=0||b%400==0)//判断是否为闰年
        {
            System.out.println(b+"年是闰年");
        }
        else{
            System.out.println(b+"年是平年");

        }
            switch (f)
            {
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:
                    System.out.println(f+"月有31天");
                    break;
                case 2:
                    if (b%4==0&&b%100!=0||b%400==0) {
                        System.out.println(f + "月有28天");
                    }
                    else {
                        System.out.println(f+"月有29天");
                    }
                    break;
                case 4:
                case 6:
                case 9:
                case 11:
                    System.out.println(f+"月有30天");
                    break;
                default:
                    System.out.println("输入月份不符");
                    break;
            }

    }
}

posted on 2019-08-27 20:51  普朗克麻辣鸡  阅读(987)  评论(0)    收藏  举报