从0~2020中选出闰年,并且要求五个一行排列
#include <iostream>
using namespace std;
int main()
{
int cnt = 0;
for (int i = 0; i <= 2020; i++)
{
if ((i % 4 == 0 && i % 100 != 0) || (i % 400 == 0))
{
cnt ++;
cout << i << " ";
if(cnt % 5 == 0){
cout << endl;
}
}
}
}