Enter a grade from the keyboard and judge the grade corresponding to the grade (if branch statement)

The code is as follows:

/*Enter a grade from the keyboard and judge the grade corresponding to the grade * / import Java util. Scanner; Class demo8 {public static void main (string [] args) {scanner SC = new scanner (system. In); system.out.println ("please enter a score:"); int score = sc.nextint(); if (score > = 90 & & score < = 100) system.out.println ("a"); else if (score > = 80 & & score < 90) system.out.println ("B"); else if (score > = 70 & & score < 80) system.out.println ("C"); else if (score > = 60 & & score < 70) System. out. println("D"); else System. out. println("E"); } }

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>