闰年的判断,主要满足以下条件:年份%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+"不是闰年");  

   }  

}

}

相关文章:

  • 2021-10-24
  • 2021-11-28
  • 2021-11-28
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-28
  • 2022-01-01
  • 2022-12-23
  • 2021-10-04
  • 2021-11-28
  • 2021-11-28
相关资源
相似解决方案