编写程序,显示 21 世纪(2001 年到 2100 年)所有的闰年,每行 10 个。如下图所示:


显示闰年显示闰年




public class Test1 {



public static void main(String[] args) {
// TODO 自动生成的方法存根
int count = 0;
for(int year=2000;year<=2100;year++){
if((year%4==0&&year%100!=0)||(year%400==0)){
count++;
if(count%10==0)
System.out.println(year);
else
System.out.print(year+" ");
}
}
}


}

相关文章:

  • 2021-12-05
  • 2021-12-18
  • 2021-09-06
  • 2021-11-28
  • 2021-11-28
  • 2021-11-28
  • 2021-12-23
  • 2021-08-10
猜你喜欢
  • 2022-02-17
  • 2021-12-31
  • 2021-12-02
  • 2022-12-23
  • 2021-08-30
  • 2021-10-27
相关资源
相似解决方案