Question: Determine whether each year in 2000-2500 is a leap year, and output the result.
Judgment conditions for leap year: (1): It is a leap year that is divisible by 4 but not divisible by 100.
(2): Divisible by 100 and 400 at the same time.
C language source program:
#include<stdio.h>
int main()
{
int year;
for(int i=2000;i<2500;i++)
{
year=i;
if(year%4==0&&year%100!=0||year%400==0)
{
printf("%d 是闰年\n",year);
}
else
{
printf("%d 不是闰年!\n",year);
}
}
return 0;
}