闰年:年份是整百倍的且能够被400整除或者能被4整除不能被100整除的年份
import java.util.Scanner;
/**
* 判断该年份是不是闰年
* 公历年份是整百倍的能够被400整除或者能被4整除不能被100整除的年份是闰年
*/
public class Year {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);//创建对象
while (scanner.hasNextInt()) {//判断是否还有数字输入,如果有就继续
int year = scanner.nextInt();
if (year % 100 == 0) {//能够被100整除
if (year % 400 == 0) {//能够被400整除
System.out.println(year + " is leapYear");
} else {
System.out.println(year + " is not leapYear");
}
} else {
if (year % 4 == 0) {//能被4整除
System.out.println(year + " is leapYear");
} else {
System.out.println(year + " is not leapYear");
}
}
}
}
}