……哥,他说了还要用if else
#include
int main()
{
int score,grade;
printf("请输入成绩:\n");
scanf("%d",&score);
if(score<60)
grade=5;
else if(score<70)
grade=4;
else if(score<80)
grade=3;
else if(score<90)
grade=2;
else if(score<=100)
grade=1;
switch(grade)
{
case 5:printf("E");break;
case 4:printf("D");break;
case 3:printf("C");break;
case 2:printf("B");break;
case 1:printf("A");break;
default:break;
}
printf("\n");
return 0;
}
switch(a/10){
case 9: case 10:printf("A");break;
case 8:printf("B");break;
case 7:printf("C");break;
case 6:printf("D");break;
default:printf("E");break;
}