java if-else语句判断年份月份--day3下午

public static void main(String[] args) 
                        System.out.println("请输入年份");
			Scanner sc = new Scanner (System.in);
			int y= sc.nextInt();
			
		         System.out.println("请输入月份");
			Scanner sa = new Scanner (System.in);
			int m = sc.nextInt();
			
		    if(y%4==0&&y%100==0||y%400==0){
                            System.out.println(y+"是闰年");
                        }else{
                           System.out.println(y+"是平年");
                        }
                       if(m==1||m==3||m==5||m==7||m==8||m==10||m==12){
                                System.out.println(y+"年"+m+"月有31天");
                          }else if (m==4||m==6||m==9||m==11){
                                System.out.println(y+"年"+m+"月有30天");
                          }else if (y % 4 == 0 && y % 100 != 0 && m == 2){
                                System.out.println(y+"年"+m+"月有29天");
                         } else{
                                System.out.println(y+"年"+m+"月有28天");
   }
   }
   }

你可能感兴趣的:(java if-else语句判断年份月份--day3下午)