利用条件运算符的嵌套来完成此题:学习成绩> =90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示。

 1 import java.util.Scanner;
 2 
 3 
 4 public class Algorithm_Game_05 {
 5 
 6     public static void main(String[] args) {
 7         
 8         Scanner s = new Scanner(System.in);
 9         int n = s.nextInt();
10         String str = "";
11         str=n>=90?"A":n<60?"C":"B";
12         System.out.println(str);
13     }
14 }

 

posted on 2013-08-26 19:32  elleniou  阅读(1646)  评论(0编辑  收藏  举报