int counter1 = 0;
int counter2 = 0;
for(int i = 101;i<=2100;i++) {
if((i%4==0 && i%100!=0)||i % 400==0) {
System.out.print(i+" ");
counter1++;
counter2++;
}
if(counter1%10==0 && counter1>1) {
System.out.println();
counter1=0;
}
}
System.out.print("\nThe number of leap year is:"+counter2);
java语言程序设计 第十版(基础篇)5.27
最新推荐文章于 2024-06-21 23:09:03 发布