public class 判断是否是闰年 { public static void main(String[] args){ int year = 2200; if (year % 4 == 0){ if (year % 100 == 0){ if (year % 400 == 0) { System.out.println(year + "是闰年"); } else { System.out.println(year + "不是闰年"); } } else { System.out.println(year + "是闰年"); } } else { System.out.println(year + "不是闰年"); } } }
判断年份是闰年还是平年
于 2024-03-28 19:16:40 首次发布