#include<stdio.h>
void main()
{
int year,flag;
while(year!=0)
{
printf("input year(0 to end!):\n");
scanf("%d",&year);
if(year%4==0)
if(year%100!=0)
flag=1;
else if(year%400==0)
flag=1;
else
flag=0;
else
flag=0;
if(year!=0)
{
if(flag)
printf("%d is a leap year\n",year);
else
printf("%d is not a leap year\n",year);
}
}
}
学习C/C++语言:判断是否为闰年
最新推荐文章于 2024-05-04 13:38:58 发布