#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> int Leapyear(int year) { int flag=0; if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { flag = 1; } return flag; } int main() { int year,flag; printf("请输入年份\n"); scanf("%d", &year); flag=Leapyear(year); if (flag == 0) { printf("不是闰年\n"); } if (flag == 1) { printf("是闰年\n"); } system("pause"); return 0; }
文章来源: https://blog.csdn.net/Whitebury/article/details/88854619