发布网友 发布时间:2024-06-03 11:44
共5个回答
热心网友 时间:2024-06-15 12:32
#include <stdio.h>
int main()
{
int score, m;
scanf("%d", &score);
while (score < 0 || score > 100){
printf("Error! Retry!\n");
scanf("%d", &score);
}
m= score / 10;
if (m>= 9)
printf("Grade is A!\n");
switch(m){
case 0: printf("Grade is E!\n"); break;
case 1: printf("Grade is E!\n"); break;
case 2: printf("Grade is E!\n"); break;
case 3: printf("Grade is E!\n"); break;
case 4: printf("Grade is E!\n"); break;
case 5: printf("Grade is E!\n"); break;
case 6: printf("Grade is D!\n"); break;
case 7: printf("Grade is C!\n"); break;
case 8: printf("Grade is B!\n"); break;
}
return 0;
}
扩展资料:
其他实现输出成绩等级‘A'、’B‘、'C'、‘D'、'E’。90分以上为A,80~89分为B,70~79分为C,60~69分为D,60分一下为E的方法:
#include <stdio.h>
int main()
{
int score;
scanf("%d", &score);
while (score < 0 || score >100){
printf("Error! Retry!\n");
scanf("%d", &score);
}
if (score < 60)
printf("Grade is E!\n");
else if (score >= 60 && score < 70)
printf("Grade is D!\n");
else if (score >= 70 && score < 80)
printf("Grade is C!\n");
else if (score >=80 && score < 90)
printf("Grade is B!\n");
else
printf("Grade is A!\n");
return 0;
}
热心网友 时间:2024-06-15 12:34
#include <stdio.h>热心网友 时间:2024-06-15 12:32
#include <stdio.h>热心网友 时间:2024-06-15 12:36
switch()语句就可以阿热心网友 时间:2024-06-15 12:37
#include<stdio.h>