/** * Title: Demo05_判断平年闰年.java * @author Mr.Seven * @date 2020年9月2日 * @version 1.0 */ package cn.tedu.day902;
import java.util.Scanner;
public class Demo05_判断平年闰年 {
public static void main(String[] args) { // TODO Auto-generated method stub System.out.println("请输入要查询的年号:"); String s = "平年"; // int year = new Scanner(System.in).nextInt(); Scanner sc = new Scanner(System.in); int year = sc.nextInt(); sc.close(); if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { s = "闰年"; } System.out.println(year + "年是" + s);
}
}