判断闰年
#include<stdio.h>
#include<math.h>
#include<stdbool.h>
//判断闰年
bool Is_Leapyear(int year)
{
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0))
return true;
else
return false;
}
int main()
{
while (1)
{
int year;
printf("请输入年份:");
scanf("%d", &year);
if (Is_Leapyear(year))
printf("%d是闰年\n\n", year);
else
printf("%d不是闰年\n\n", year);
}
system("pause");
return 0;
}