填空题 以下程序的功能是:从键盘上输入若干学生的成绩,统计并输出最高成绩和最低成绩,当输入负数时结束输入,请填空。
试题程序

#include <stdio.h>
main()
{ float x, amax, amin;
scanf("% f", &x);
amax=x; amin=x;
while(______)
{ if(x>amax) amax=x;
if(______) amin=x;
scanf("% f", &x);
}
printf("/namax=% f/n amin=% f/n", amax, amin);
}
  • 1、
【正确答案】 1、x>=0 x<amin    
【答案解析】[解析] 阅读以上程序可知,最高成绩放在变量amax中,最低成绩放在amin中。while循环用于不断读入数据放入x中,并通过判断把大于amax的数放入amax中,把小于amin的数放入amin中。因此在第二个横线处应填入x<amin。while后的表达式用以控制读入的成绩是否为负数,若是负数,读入结束并且退出循环,因此在第一个横线处应填入x>=0,即当读入的值大于等于0时,循环继续,小于0时循环结束。