求哪一年是闰年的问题。后面有几行是这样的,
printf("%d is",year):
esle
printf("%d is not",year);
printf("a leap year\n")
可以改成:
printf("%d is a leap year",year):
else
printf('%d is a leap year",year);
注:leap是“是否闰年”的意思
求哪一年是闰年的问题。后面有几行是这样的,
printf("%d is",year):
esle
printf("%d is not",year);
printf("a leap year\n")
可以改成:
printf("%d is a leap year",year):
else
printf('%d is a leap year",year);
注:leap是“是否闰年”的意思
可以这样写啦
#include <stdio.h>
main()
{
int YEAR,YEAREND=3000;
printf ("enter year.\n");
scanf ("%d",&YEAR);
for (;YEAR<=YEAREND;YEAR=YEAR+1)
{if (YEAR%4==0)
{if (YEAR%100!=0)
printf ("%d\t",YEAR);
else
if (YEAR%400==0)
printf ("%d\t",YEAR);
}
}
}