根据课本编写,自己添加了一丢丢
#include<stdio.h> int main() { int year,a; printf("请输入年份: "); scanf_s("%d", &year); a = ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0); if (a == 1) printf("闰年 "); else printf("不是闰年 "); return 0; }