普通闰年:能被4整除但不能被100整除的年份为普通闰年。(如就是闰年,1900年不是闰年);
世纪闰年:能被400整除的为世纪闰年。(如2000年是世纪闰年,1900年不是世纪闰年);
#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>#include <stdlib.h>//是闰年返回1,不是闰年返回0void main() {int year,leap_year;printf("请输入年份:");scanf("%d", &year);printf("\n"); if (year % 100 == 0)//判断是不是世纪闰年{if (year % 400 == 0){leap_year = 1;}else {leap_year = 0;}}else//判断是不是普通闰年{if (year % 4 == 0){leap_year = 1;}else{leap_year = 0;}}if (leap_year) {printf("%d年是", year);}else{printf("%d年不是", year);}printf("闰年。\n");system("pause");}