计算成绩分数所在等级,给出一百分制成绩,要求。输出成绩等级A、B、C、D、E。90分以上为A.80~89为B,70~79为C,60~69为D,60分下为E
时间: 2023-05-12 13:05:44 浏览: 96
ChatGPT: 根据您提供的要求,我可以给出以下代码实现:
```
score = float(input("请输入成绩:"))
if score >= 90:
print("成绩等级为A")
elif score >= 80:
print("成绩等级为B")
elif score >= 70:
print("成绩等级为C")
elif score >= 60:
print("成绩等级为D")
else:
print("成绩等级为E")
```
请注意,这是一个简单的 Python 代码,可以根据您的需要进行修改和优化。
相关问题
用c语言计算成绩分数所在等级,给出一百分制成绩,要求输出成绩等级A、B、C、D、E。90分以上为A,80~89为B,70~79为C,60~69为D,60分下为E。
以下是用 C 语言计算成绩分数所在等级的代码:
```
#include <stdio.h>
int main() {
int score;
printf("请输入成绩:");
scanf("%d", &score);
if (score >= 90) {
printf("成绩等级为 A\n");
} else if (score >= 80) {
printf("成绩等级为 B\n");
} else if (score >= 70) {
printf("成绩等级为 C\n");
} else if (score >= 60) {
printf("成绩等级为 D\n");
} else {
printf("成绩等级为 E\n");
}
return 0;
}
```
这个程序可以根据输入的成绩计算出对应的成绩等级,并输出结果。
3、计算成绩分数所在等级,给出一百分制成绩,要求输出成绩等级A、B、C、D、E。90分以上为A,80~89为B,70~79为C,60~69为D,60分下为E。
ChatGPT: 根据您提供的要求,我可以为您提供以下代码:
```
score = int(input("请输入成绩:"))
if score >= 90:
print("成绩等级为A")
elif score >= 80:
print("成绩等级为B")
elif score >= 70:
print("成绩等级为C")
elif score >= 60:
print("成绩等级为D")
else:
print("成绩等级为E")
```
请注意,这是一个简单的 Python 代码,可以根据用户输入的成绩计算出对应的成绩等级。如果您有任何其他问题,请随时提出。
相关推荐
![c](https://img-home.csdnimg.cn/images/20210720083646.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)