编写程序用C加加编写输出1980到2880年所有闰年的年号每输出五个年号换一行
时间: 2024-06-12 18:06:00 浏览: 184
C#版闰年代码
```cpp
#include <iostream>
using namespace std;
int main() {
int year = 1980;
int count = 0;
while (year <= 2880) {
if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
cout << year << " ";
count++;
if (count == 5) {
cout << endl;
count = 0;
}
}
year++;
}
return 0;
}
```
阅读全文