读入一个表示年份的整数,判断这一年是否是闰年。
程序员文章站
2022-07-07 09:47:27
...
import java.util.Scanner;
public class t4 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int y=sc.nextInt();
if((y%400==0)||(y%4==0&&y%100!=0))
System.out.println("是闰年");
else
{
System.out.println("不是闰年");
}
}
}