给出一百分制成绩,要求输出等级'A' 'B' 'C' 'D' 'E'

90分以上为A,80到89为‘B’,70到79为‘C’,60到69为‘D’60以下为‘E’

#include<stdio.h>
int main()
{
int a,b;
printf("请输入100以内的分数:") ;
scanf("%d",&a);
if(a>=90)        b=1;
if(a>=80&&a<=89) b=2;
if(a>=70&&a<80)  b=3;
if(a>=60&&a<70)  b=4;
if(a<60)         b=5;
switch(b)
{ case 1:printf("your score is A");break; 
  case 2:printf("your score is B");break;
  case 3:printf("your score is C");break;
  case 4:printf("your score is D");break;
  case 5:printf("your score is E");break;
}
return 0;
}

猜你喜欢

转载自blog.csdn.net/weixin_43742177/article/details/84306587