根据提示,在右侧编辑器补充代码:
程序中要求输出从公元1000年至2000年所有闰年的年号,每输出3个年号换一行。
判断闰年的两种条件是:
(1)公元年数能被4整除,而不能被100整除;
(2)公元年能被400整除。

根据提示,在右侧编辑器补充代码:
程序中要求输出从公元1000年至2000年所有闰年的年号,每输出3个年号换一行。
判断闰年的两种条件是:
(1)公元年数能被4整除,而不能被100整除;
(2)公元年能被400整除。

#include <stdio.h>
int main() {
int startYear = 1000;
int endYear = 2000;
int count = 0;
printf("公元1000年至2000年之间的闰年:\n");
for (int year = startYear; year <= endYear; year++) {
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
printf("%d\t", year);
count++;
// 每输出3个年号换一行
if (count % 3 == 0) {
printf("\n");
}
}
}
printf("\n");
return 0;
}