如题所述
第1个回答 2019-04-17
if(score >= 70 && score < 75)
第2个回答 2019-04-17
这个程序中,第六行和第13行,第15行都错了。
因为其中涉及到一个75分。所以,如果用switch语句来做的话,应该用除以5的结果来进行分类。所以这个题目如果没有规定必须要用多分支语句来做的话,使用if和else反而来的方便。
#include "stdio.h"
int main()
{ int score;
scanf("%d",&score);
if(score<60)printf("E\n");
else if(score<70)printf("D\n");
else if(score<75)printf("Error\n");
else if(score<80)printf("C\n");
else if(score<90)printf("B\n");
else printf("A\n");
return 0;
}