总是不知道怎样用循环
从键盘上输入10个百分制成绩score,按下列原则输出其等级:score≥90,等级为A;80≤score<90,等级为B;70≤score<80,等级为C;60≤score<70,等级为D;score<60,等级为E。我看书上是这样编的:main()
{int score, grade;
printf("Input a score(0~100): ");
scanf("%d", &score);
grade = score/10; /*将成绩整除10,转化成switch语句中的case标号*/
switch (grade)
{case 10:
case 9: printf("grade=A\n"); break;
case 8: printf("grade=B\n"); break;
case 7: printf("grade=C\n"); break;
case 6: printf("grade=D\n"); break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0: printf("grade=E\n"); break;
default: printf("The score is out of range!\n");
这不但有一个错误,还不能循环,求解!!!