百分之转5分制,5分制转百分制
int main()
{
char grade = 0;
scanf("%c", &grade);
switch (grade)
{
case 'A':
printf("优秀:90-100分\n");
break;
case 'B':
printf("良好:80-89分\n");
break;
case 'C':
printf("中等:70-79分\n");
break;
case 'D':
printf("及格:60-69分\n");
break;
case 'E':
printf("不及格<60\n");
break;
default:
printf("输入错误!!");
break;
}
return 0;
}
int main()
{
int score = 0;
printf("请输入你的分数:");
scanf("%d", &score);
if (score > 100 || score < 0)
{
printf("输入错误!");
}
else
{
switch (score / 10)
{
case 10:
case 9:
printf("优秀\n");
break;
case 8:
printf("良好\n");
break;
case 7:
printf("中等\n");
break;
case 6:
printf("及格\n");
break;
default:
printf("不及格\n");
break;
}
}
return 0;
}