#include
int main()
{
int year,result;
scanf("%d",&year);
if( year%4 == 0 && year % 100 != 0 || year % 400 == 0 )
result=1;
else
result=0;
printf("%d",result);
return 0;
}
判断闰年:如果年份能被4 整除且不能被100整除,或者年份能被400整除,则这一年是闰年。
#include
int main(void)
{
int i,j;
scanf("%d",&i);
if(i%400==0)
j=1;
else if(i%100==0)
j=0;
else if(i%4==0)
j=1;
else
j=0;
printf("%d\n",j);
return 0;
}
#include
int main(){
int x,y;
scanf("%d",&x);
if(x%4==0&&x%100!=0||x%400==0)
y=1;
else y=0;
printf("%d",y);
return 0;}
int i;
scanf("%d", &i);
printf("%d\n",(i%400==0)||(i%100!=0&&i%4==0));