闰年的判断,主要满足以下条件:年份%4==0&&年份%100!=0或者年份%400==0&&年份%100=0;
java代码表示如下:
public class Runnian {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("请输入年份:");
int s = sc.nextInt();
if((s%4==0&&s%100!=0)||(s%400==0&&s%100==0)) {
System.out.println(s+"是闰年");
}else {
System.out.println(s+"不是闰年");
}
}
}