为方便广大考生更好的复习2013年计算机二级C语言考试,查找考试辅导习题,网校特提供了C语言上机预测题(填空题、改错题、编程题),更多模拟无纸化考试“计算机二级C语言模拟题”,供考生学习。
填空题
请补充fun函数,该函数的功能是:判断一个年份是否为闰年.
例如,1900年不是闰年,2004是闰年.
注意:部分源程序给出如下
请勿改动主函数main和其他函数中的任何内容,仅在fun函数的横线上填如所编写的若干表达式或语句。
试题程序:#include <stdio.h>
#include <conio.h>
int fun(int n)
{
int flag = 0;
if (n%4 == 0)
if (___1___)
flag = 1;
if (___2___)
flag = 1;
return ___3___;
}
main()
{
int year;
printf("Input the year:");
scanf("%d", &year);
if (fun(year))
printf("%d is a leap year.\n", year);
else
printf("%d is not a leap year.\n", year);
}
第1处填空:n%100 !=0或0 !=n%100
第2处填空:N400==0或!(n%400)或0==n%400
第3处填空:flag