/* P61 if条件语句 2020-03-13 23:57:28
* 大学英语四级合格分数为425分,以为大学生英语四级分数为424分,判断并输出该学生是否通过了英语四级考试.
*/
public class Cba_LevelFourScore {
public static void main(String[] args) {
int standard = 425;// 声明int型变量standard(标准),并赋初值
int score = 424; // 声明int型变量score(分数),并赋初值
if (score >= standard) {
System.out.println("该学生通过了英语四级考试");
} else {
System.out.println("该学生没有通过英语四级考试");
}
}
}
/* 光盘\Code\Try\03\01
public class LevelFourScore {
public static void main(String[] args) {
int score = 424;
if (score < 425) {
System.out.println("很遗憾!距及格线425,还有" + (425 - score) + "分的差距,请继续努力……" );
}
if (score >= 425) {
System.out.println("闯关成功!成绩单将择日送抵贵校……" );
}
}
}
*/
学习笔记_if条件语句
最新推荐文章于 2024-02-06 16:44:21 发布