2013年计算机等级二级C语言考前冲刺试题及答案1-6
来源:2exam.com 2013-9-29 19:10:57
2.【程序填空】 --------------------------------------------------------- 题目:本程序用getchar函数输入一个字符给变量s,完善程序。 -------------------------------------------------------*/ #include“stdio.h” main() { char s; /***********FILL***********/ _____ putchar(s); } 【参考答案】 s=getchar(); /*------------------------------------------------------- 3.【程序填空】 --------------------------------------------------------- 题目:从键盘上输入若干个学生的成绩,统计并输出最高成绩和最 低成绩,当输入负数结束。请填空。 -------------------------------------------------------*/ #include "stdio.h" main() { float x,amax,amin; scanf("%f",&x); amax=x; amin=x; /***********FILL***********/ while(_____) { /***********FILL***********/ if(_____)amax=x; if(x scanf("%f",&x);
}
printf("amax=%f,amin=%f\n",amax,amin)
}
【参考答案】
x>=0
x>=0.0
【参考答案】
x>amax
x>=amax
/*-------------------------------------------------------
4.【程序填空】
---------------------------------------------------------
题目:以每行4个数据的形式输出数组a。
-------------------------------------------------------*/
#include "stdio.h"
#define N 20
main()
{
int a[N],i;
/***********FILL***********/
for(i=0;_____;i++)
{
/***********FILL***********/
if(i%4==0) _____
printf("=",a[i]);
}
}
【参考答案】
i 【参考答案】
printf("\n");
触屏版 电脑版
3773考试网 琼ICP备12003406号-1