20170727 JAVA练习题:运用if else根据分数分成绩等级

JAVA练习题:运用if else根据分数分成绩等级
package com.chy.g2;

import java.util.Scanner;

public class Exercise2 {

public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("请输入成绩:");
Scanner sc = new Scanner(System.in);
int grade = sc.nextInt();
if (grade >90) {
System.out.println("A级");
} else if (grade >= 80) {
System.out.println("B级");
} else if (grade >= 70) {
System.out.println("C级");
} else if (grade >= 60) {
System.out.println("D级");
} else {
System.out.println("E级");
}

}

}

你可能感兴趣的:(20170727 JAVA练习题:运用if else根据分数分成绩等级)