标签:style blog ar color os sp java for on
描述输入一个百分制的成绩M,将其转换成对应的等级,具体转换规则如下:
90~100为A;
80~89为B;
70~79为C;
60~69为D;
0~59为E;
2
97
80
A
B
1 import java.text.NumberFormat; 2 import java.util.Arrays; 3 import java.util.Scanner; 4 5 public class Main { 6 public static void main(String[] args) { 7 Scanner scanner=new Scanner(System.in); 8 int T; 9 int grade; 10 char c; 11 12 T=scanner.nextInt(); 13 14 while(true){ 15 if(T==0) 16 break; 17 T--; 18 19 grade=scanner.nextInt(); 20 21 if(grade>=90) 22 c=‘A‘; 23 24 else if(grade>=80) 25 c=‘B‘; 26 27 else if(grade>=70) 28 c=‘C‘; 29 30 else if(grade>=60) 31 c=‘D‘; 32 33 else 34 c=‘E‘; 35 36 System.out.println(c); 37 } 38 } 39 }
标签:style blog ar color os sp java for on
原文地址:http://www.cnblogs.com/zqxLonely/p/4132012.html