1:你要清楚什么样的年份才是闰年(能被4整除且不能被100整除或者能被400整除的,参考
2:判断语句
if( ((0==year%4)&&(0!=year%100))||(0==year%400))
{
//满足该条件的yeat就是闰年。
}
以下是源程序代码:
int main (void) {
int year;
printf ("please a year:");
scanf ("%i",&year);
if((year%4==0 && year%100!=0)||year%400==0){
printf ("%i is a leap year!",year);
}else{
printf ("%i is not a leap year!",year);
}
return 0;
}