Linux基础知识学习
C语言作业:
用switch语句实现——成绩分等级,90+:优 80~89良上,70~79良,60~69及格,<60不及格
#include <stdio.h>
main(){
int source;
printf("请输入成绩:
");
scanf("%d",&source);
if(source>=0&&source<=100){
switch (source/10)
{
case 10:
case 9:
printf("优
");
break;
case 8:
printf("良上
");
break;
case 7:
printf("良
");
break;
case 6:
printf("及格
");
break;
default:
printf("不及格
");
break;
}
}
else
printf("输入有误!
");
}