下面程序的功能是从键盘上输入若干学生的学习成绩,统计并输出最高成绩和最低成绩,当输入为负数时结束输入。 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\namin=%f\n",amax,amin); }
举一反三
- 以下程序的功能是:从键盘上输入若干个学生的成绩,统计并输出最高成绩和最低成绩,当输入负数时结束输入。请填空。 A: x<=0 B: x>0x>amin x<=amin C: x>0 D: x>=0x>amin x<amin
- 从键盘上输入若干学生的成绩,统计并输出最高成绩和最低成绩,当输入负数时结束输入。请在下列程序中填空。 #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(" max=%f min=%f ",max,min); getchar(); }
- 以下程序的功能是:从键盘输入若干学生的成绩,统计并输出最高成绩和最低成绩,当输入...x,amin); return 0; }
- 下列程序的功能是从键盘上输入若干员工的工资,统计并输出最高工资和最低工资,当输入负数时结束输入。 main() float x,max,min; scanf("%f",&x); ______ while(______) if(x>max)max=x; if(x<min)min=x; ______ printf("\nmax=%f\nmin=%f\n",max,min);
- 以下程序的功能是:从键盘上输入若干个学生的成绩,统计并输出最高成绩和最低成绩,当输入负数时结束输入,请在划线处填空。#include 〈stdio.h〉main(){ float x,max,min; ______①______; //输入第一个数作为 max,min起点 max=x;min=x; while(___②___) { if(x>max) __③__; if( __④___ ) min=x; scanf("%f",&x); } printf("Max=%f\nMin=%f\n",max,min); return 0;}