今天分享一个程序-判断1000-2000年之间输入的任何一个年份是否是闰年
#判断是否是闰年
#include<stdio.h>
#include<stdlib.h>
int main()
{
int year;
printf("please input the year between 1000 and 2000:");
scanf("%d",&year);
if ((year % 4 == 0 && year % 100 != 0)|| year % 400 == 0)
{
printf("yes\n");
}
else
{
printf("no\n");
}
system("pause");
return 0;
}
这个程序还是简单的if语句的使用,核心语句就是if中的那句话,要记住判断闰年的条件就是那句话。