#include<stdio.h>
int main()
{
int year,leap;
printf("enter year:");
scanf("%d",&year);
if(year%4==0)
{
if(year%100==0)
{
if(year%400==0)
leap=1;
else
leap=0;
}
else
leap=1;
}
else
leap=0;
if(leap)
printf("%d is",year);
else
printf("%d is not",year);
printf("a leap year.\n");
return 0;
}
C程序设计 例题 判读某一年是否为闰年(1)
最新推荐文章于 2024-06-19 11:41:47 发布