#include <stdio.h>
int main()
{
int year = 2014; //今年是2014年
//补全一下代码
if(year%4 == 0 )
{
printf("%S\n","今年是闰年");
}
else
{
printf("%s\n","今年是平年");
}
return 0;
}
if(year%4 == 0||year%400==0&&year%100!==0 )
void runnian(int year) { if (year % 400 == 0 || year % 100 != 0 && year % 4 == 0) { printf(" %d 年是闰年\n", year); } else { printf(" %d 年不是闰年\n", year); } } int main () { runnian(2012); runnian(2000); runnian(1900); runnian(2014); runnian(1999); } 测试一下看看
void runnian(int year) { if (year % 400 == 0 || year % 100 != 0 && year % 4 == 0) { printf(" %d 年是闰年\n", year); } else { printf(" %d 年不是闰年\n", year); }}int main () { runnian(2012); runnian(2000); runnian(1900); runnian(2014); runnian(1999);
#include <stdio.h>
int main()
{
int year = 2014; //今年是2014年
//补全一下代码
if(year%4 == 0 )
{
printf("%S\n","今年是闰年");
}
else
{
printf("%s\n","今年是平年");
}
return 0;
}