#include “stdio.h”
void main()
{
int score[200];
int counter1=0,counter2=0,counter3=0,counter4=0,counter5=0;
int i=0;
for(i=0;i<200;i++)
{
scanf("%d",&score[i]);
if((score[i] == -1))
break;
else if(score[i]>=90)
counter1++;
else if(score[i]>=80)
counter2++;
else if(score[i]>=70)
counter3++;
else if(score[i]>=60)
counter4++;
else
counter5++;
}
printf(" <60 is %d\n 60-69 is %d\n 70-79 is %d\n 80-89 is %d\n 90-100 is %d\n ",counter5,counter4,counter3,counter2,counter1);
}
从键盘中输入全班同学们的C语言课程的成绩,输入-1时停止,统计出各分数段的人数,并输出。(<60、60-69、70-79、80-89、90-100)
最新推荐文章于 2022-09-19 22:53:47 发布