解题思路:
注意事项:
while(score!=0&&score!=-1)
{
scanf("%f",&score);
if(score>=85) count1++;
else if (score>=60) count2++;
else if (score!=0&&score!=-1) count3++;
}
注意不要使输入的-1或者0 被统计其中
参考代码:
#include <stdio.h> int main() { float score=1; int count1=0,count2=0,count3=0; while(score!=0&&score!=-1) { scanf("%f",&score); if(score>=85) count1++; else if (score>=60) count2++; else if (score!=0&&score!=-1) count3++; } printf(">=85:%d\n",count1); printf("60-84:%d\n",count2); printf("<60:%d\n",count3); return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.3 (Java代码)浏览:650 |
妹子杀手的故事 (C语言代码)浏览:679 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:424 |
【亲和数】 (C语言代码)浏览:492 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:1514 |
C语言训练-求函数值 (C语言代码)浏览:571 |
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:535 |
【明明的随机数】 (C语言代码)浏览:785 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:586 |
P1000 (C语言代码)浏览:868 |