题目描述
编写程序,输入一批学生的成绩,遇0或负数则输入结束,要求统计并输出优秀(大于85)、通过(60~84)和不及格(小于60)的学生人数。
运行示例:
输入
输出
样例输入
<span style="color:#333333">88 71 68 70 59 81 91 42 66 77 83 0</span>
样例输出
<span style="color:#333333">>=85:2
60-84:7
<60:2</span>
#include<stdio.h>
int main(){
double scores;
int x=0,y=0,z=0;
scanf("%lf",&scores);
while(scores>0){
if(scores>85){
x=x+1;
}
else if((scores>=60)&&(scores<=84)){
y=y+1;
}
else{
z=z+1;
}
scanf("%lf",&scores);
}
printf(">=85:%d\n60-84:%d\n<60:%d\n",x,y,z);
return 0;
}