判断一年是否能是闰年,1.能被4整除,不能被100整除2.能被400整除
int year = 2024;
if ((year % 4 == 0 && year % 100 !=0)||year % 400 ==0) {
System.out.print(year+"是闰年");
}else {
System.out.print(year+"不是闰年");
}
判断一年是否能是闰年,1.能被4整除,不能被100整除2.能被400整除
int year = 2024;
if ((year % 4 == 0 && year % 100 !=0)||year % 400 ==0) {
System.out.print(year+"是闰年");
}else {
System.out.print(year+"不是闰年");
}