#include
void main()
{
int i,year,n;
do
{
scanf("%d",&year);
if(((year%4==0)&&(year%100!=0)) || year%400==0 )
{
printf("yeah\n");
}
else if(year==-1)
{
}
else
{
printf("no\n");
}
}while(year!=-1);
}
核心代码领会就好了
int year = 2011;
if (year % 400 == 0|| (year % 4 ==0 && year % 100 != 0))
{
printf("runnian");
} else {
printf("不是闰年");
}