#include <stdio.h>
int isLeap(int year) {
return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0);
}
int main() {
int y;
printf("輸入年份: ");
scanf("%d", &y);
printf("%d %s閏年\n", y, isLeap(y) ? "是" : "不是");
return 0;
}
2000 → 是 (400倍數)
1900 → 否 (100倍數非400)
2024 → 是 (4倍數非100)
2023 → 否