Java rewrite "C Classic 100 Questions"--15

Source: Internet
Author: User

"Program 15"
Title: Use the nesting of conditional operators to complete this problem: the students of the study score >=90 with a, 60-89 points between the use of B, 60 points below the C expression.
1. Program Analysis: (a>b)? A:b This is a basic example of a conditional operator.
2. Program Source code:

1 ImportJava.util.Scanner;2 3 /*this article transferred from blog: www.cnblogs.com/java-1004 "Program 15"5 title: Use the nesting of conditional operators to complete this problem: the students of the study score >=90 with a, 60-89 points between the use of B, 60 points below the C expression. 6 Program Analysis: (a>b)? A:b This is a basic example of conditional operators. 7  */8 9  Public classJAVA15 {Ten  One      Public Static voidMain (string[] args) { ASystem.out.print ("Please enter score:"); -Scanner Scanner =NewScanner (system.in); -         intScore =scanner.nextint (); the scanner.close (); -         CharLevel = (score >= 60)? (Score >= 90?) ' A ': ' B '): ' C '; -System.out.print ("Your rating is" +Level ); -     } +}

Java rewrite "C Classic 100 Questions"--15

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.