总结的求闰年的口诀:
四年一闰,百年不闰,四百年再闰。
#include<stdio.h> #include<stdlib.h> void LeapYear() { int year = 1000; int count = 0; for (; year < 2000; year++) { if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { printf("%d ", year); count++; } } printf("\n"); printf("count = %d", count); } int main() { LeapYear(); system("pause"); return 0; }