1582年以来的置闰规则:
普通闰年:公历年份是4的倍数,且不是100的倍数的,为闰年(如2004年、2020年等就是闰年)。
世纪闰年:公历年份是整百数的,必须是400的倍数才是闰年(如1900年不是闰年,2000年是闰年)。
#define _CRT_SECURE_NO_DEPRECATE
//#include<stdlib.h>
//#include<math.h>
//#include<conio.h>
#include<stdio.h>
#include<string.h>
int main()
{
int year,
leap=0;
//system("cls");
printf("请输入年份:");
scanf("%d",&year);
if (year%4==0&&year%100!=0||year%400==0)
{
leap = 1;
}
if (leap)
{
printf("%d这是闰年\n", year);
}
else
printf("%d这不是闰年\n", year);
return 0;
}
练习自用,不喜勿喷
5万+

被折叠的 条评论
为什么被折叠?



