![#include<stdio.h>
int main(){
float score;
char grade;
for(int i=0;i<7;i++){
printf("请输入成绩:");
scanf("%f",&score);
while(score>100||score<0)
{
printf("\n输入的成绩有误,请重新输入:");
scanf("%f",&score);
}
switch((int)(score/10)){
case 10:
case 9: grade='A';break;
case 8: grade='B';break;
case 7: grade='C';break;
case 6: grade='D';break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:grade='E';
}
printf("成绩是%.1f对应的等级是%c\n",score,grade);
} return 0;
}
](https://img-blog.csdnimg.cn/fd9ec7129b614869bf042eb770a3d2fb.png)