以下是用 C 语言实现判断输入年份是否为闰年的代码: ```c #include <stdio.h> int main() { int year; printf("input a year:"); scanf("%d", &year); if ((year % 4 == 0 && year % 100!= 0) || year % 400 == 0) { printf("input a year it is a leap year!\n"); } else { printf("input a year it is not a leap year!\n"); } return 0; } ``` 在这个程序中,首先通过`scanf`函数获取用户输入的年份,然后根据闰年的判断条件进行判断,并输出相应的结果。 [2024-10-22 22:39:52 | AI写代码神器 | 168点数解答]