本题目要求读入1个整数年份,范围在0到3000内,然后判断是否是否闰年。如果是闰年输出为“Yes”,否则为“No”
输入格式:
2000
输出格式:
Yes
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int year = input.nextInt();
System.out.printf("%s\n", (year % 400 == 0 || year % 4 == 0 && year % 100 != 0) ? "Yes" : "No");
}
}