当前位置:网站首页>OJ每日一练——等级成绩
OJ每日一练——等级成绩
2022-04-21 16:09:00 【KJ.JK】
问题描述:
给出一百分制成绩,要求输出成绩等级‘A’、‘B’、‘C’、‘D’、‘E’。
90分及以上为A
80-89分为B
70-79分为C
60-69分为D
60分以下为E
输入
一个整数0-100以内,代表百分制的成绩
输出
一个字符,表示成绩等级
样例
输入
90
输出
A
Java代码:
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner rd=new Scanner(System.in);
int a=rd.nextInt();
String b=check(a);
// System.out.println(b);
}
public static String check(int a){
if(a>=90){
System.out.println("A");
}else if(a>=80&&a<=89){
System.out.println("B");
}else if(a>=70&&a<=79){
System.out.println("C");
}else if(a>=60&&a<=69){
System.out.println("D");
}else{
System.out.println("E");
}
return null;
}
}
C代码:
#include <stdio.h>
int main(){
int score;
scanf("%d",&score);
if(score>=90){
printf("A");
}else if(score>=80&&score<=89){
printf("B");
}else if(score>=70&&score<=79){
printf("C");
}else if(score>=60&&score<=69){
printf("D");
}else{
printf("E");
}
}
python代码:
score=int(input())
if score>=90 :
print("A")
elif score>=80 and score<=89:
print("B")
elif score>=70 and score<=79:
print("C")
elif score>=60 and score<=69:
print("D")
elif score<60:
print("E")
作者:KJ.JK
本文仅用于交流学习,未经作者允许,禁止转载,更勿做其他用途,违者必究。
文章对你有所帮助的话,欢迎给个赞或者 star,你的支持是对作者最大的鼓励,不足之处可以在评论区多多指正,交流学习
版权声明
本文为[KJ.JK]所创,转载请带上原文链接,感谢
https://blog.csdn.net/m0_47384542/article/details/124318951
边栏推荐
猜你喜欢

ABAP keywords at first and at last learning

多用户场景的Harbor,我是如何轻松管理的!

几种单USB转多串口的方案

New media people must have 10 efficiency tools and artifact collection

Avril 2022 classement de la base de données de la Chine: la brise printanière se réchauffe et les scores rebondissent en avril

Outsourcing student management system architecture scheme

SAP Fiori smart template技术里CDS view的注解和UI元素对应关系

. net core swagger configuration

Xiaomi Hongmi's note 4x brush machine succeeded

「查缺补漏」,DDD 核心概念梳理
随机推荐
Mark一下,两年365个粉丝
dom操作元素 总结
Qt5.14.2编译mysql
Mark, 365 fans in two years
Xiaomi Hongmi's note 4x brush machine succeeded
root 解锁问题
全国查询水电气费免费接口(一)
嵌入式GUI盘点-你了解几款?
Infrastructure 知识: DNS 命令: dig, host
Ji Geng 42 / 90
干货 | 解决 App 自动化测试的常见痛点(弹框及首页启动加载完成判断处理)
Dry goods | solve the common pain points of APP automation test (pop-up frame and home page start loading to complete judgment processing)
How can transformer break into the CV world and kill CNN?
外包学生管理系统架构方案
目前主流的手机屏幕类型都有哪些
Season change 47 / 90
R语言aov函数进行单因素方差分析(One-way ANOVA)、使用Q-Q图来评估方差分析因变量的正态性、Bartlett验证方差的相等性(齐次性)、car包中的outlierTest函数异常检验
【2023校招刷題】華為性格測評(綜合測評)戰略指南
确定还不来看看?这样管理你的代码库既方便又省心
R语言manova函数稳健多元方差分析(Robust one-way MANOVA)、rrcov包中的wilks.test函数稳健单向MANOVA、vegan包的adonis函数非参数Manova等效