问题
填空题
以下程序的功能是:从键盘输入若干个学生的成绩,统计出最高成绩和最低成绩,当输入负数时结束输入。
#include<stdio.h>
main()
float x,amax,amin;
scanf("%f",&x);
amax=x:
amin=x;
while( )/*第一空*/
if(______)amax=x;/*第二空*/
if(x<amin)______;/*第三空*/
scanf("%f",&x);
printf("amax=%3.2f,amin=%3.2f\n",amax,amin);
答案
参考答案:x>=0/*第一空。决定输入终止的条件*/
x>amax/*笫二空。比较x与max的大小,并使amax获得最大值*/
amin=x/*第三空。比较x与amin的大小,并使amin获得最小值*/