【填空题】从键盘上输入若干学生的成绩 统计并输出最高成绩和最低成绩 当输入负数时结束输入。请在
已帮助 人
【填空题】从键盘上输入若干学生的成绩,统计并输出最高成绩和最低成绩,当输入负数时结束输入。请在下列程序中填空。 #include<stdio.h> int main() { float x,max,min; printf("please input scores:"); scanf("%f",&x); max=min=x; while(___1___) { if(___2__)max=x; if(___3__)min=x; scanf("%f",&x); } printf("nmax=%fnmin=%fn",max,min); getchar(); }

回答
共1条回复-
试题1分析 ********************** 本题中函数的功能是统计并输出最高成绩和最低成绩,当输入负数时结束输入,所以判断条件为x>=0,根据输入的值与第一个值进行比较,如果比它大,将值赋给amax,如果比它小,将值赋给amin。 试题1答案 ************************* [1] x>0.0(或x>=0),[2] x
