编程题:学生成绩评分
#include<stdio.h>
void main()
{ int score;
printf("请输入学生分数:");
scanf("%d",&score);
switch(score/10)
{ case 10:
case 9:printf("成绩优秀\n"); break; /*成绩在90~100分*/
case 8:printf("成绩良好\n"); break; /*成绩在80~89分*/
case 7:printf("成绩中等\n"); break; /*成绩在70~79分*/
case 6:printf("成绩及格\n"); break; /*成绩在60~69分*/
case 5:
case 4:
case 3:
case 2:
case 1:
case 0:printf("成绩不及格\n"); break; /*成绩在0~59分*/
default:printf("输入分数错误\n");
}
}
转载于:https://blog.51cto.com/c10086/1413852