public class Task_10101003_02 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("请输入一个年份:");
int year = input.nextInt();
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
System.out.println("这一年是闰年");
}else {
System.out.println("这一年不是闰年");
}
}
}
输入年份,判断输入的年份是否是闰年。(闰年的条件是能被 4 整除,但不能被 100 整除;或能被 400 整除。)
最新推荐文章于 2022-06-14 00:00:48 发布