#include<stdio.h> int charg(int year) { if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { return 1; } else return 0; } int main() { int year,a; printf("請輸入你要判斷的年份>\n"); scanf_s("%d", &year); a = charg(year); if (a == 1) { printf("%d年是瑞年\n", year); } else { printf("%d年不是瑞年\n", year); } return 0; }