要求:
90分以上为‘A’,80-89分为‘B’,70-79为‘C’,60-69为‘D’, 60分以下为‘E’。
#include<stdio.h>
#include<math.h>
void main()
{
int score,temp;
char ch;
scanf("%d",&score);
temp=score/10;
if(score<0&&score>100)
printf("score error, input score again!");
else
switch(temp)
{
case 10:
break;
case 9: ch='A';
break;
case 8: ch='B';
break;
case 7: ch='C';
break;
case 6: ch='D';
break;
default: ch='E';
printf("You should have a work hard\n");
break;
}
printf("score=%d\nch=%c\n",score,ch);
}