Leap year calculation rules, can be divisible by 4 and not divisible by 100, or can be divisible by 400
#include <stdio.h>
#include <stdlib.h>
int main()
{
int year=0;
scanf_s("%d",&year);
if((year%4==0&&year%100!=0)||(year%400==0))
printf("这一年是闰年\n",year);
else
printf("这一年不是闰年\n",year);
system("pause");
return 0;
}
In this way, it is very convenient to judge which year is a leap year.