C语言之成绩转换

#include<stdio.h>
int main()
{
int score,grade;
scanf("%d",&score);
grade=score/10;
switch (grade)
{
case 10:
case 9:
printf("A\n");
break;
case 8:
printf("B\n");
break;
case 7:printf("C\n");
break;
case 6:printf("D\n");
break;
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:printf("F\n");
break;
default:
// printf("什么鬼\n");
break;
}
return 0;
}
//注意:在两个数做运算时,只要有一个是浮点数,计算的结果均为浮点数!

posted @ 2016-08-02 15:14  A-inspire  Views(1479)  Comments(0Edit  收藏  举报