C # Selection Statement Exercise 1

Source: Internet
Author: User

1. Please enter a number x, if x<1, then y=x; if 1<=x<10, then y=2x-1, if x>=10, then y=3x-11, ask arbitrarily enter an X value, find the Y value.

2. Enter the question "Do you have a house?" "If the answer is print out," Get married! "If you answer no, then print the second question." Are you rich? "If the answer is to print out" buy a house before marriage, "if the answer does not print out a third question," Are you capable? " "If the answer is to print out" make money before you buy a house and then get married, "if the answer does not print out" goodbye. "

3. Enter the current number of hours, using the conditional operator to determine whether it is am or PM; output "Now it's am/pm."

4. The keyboard enters three different integers, using the conditional operator to arrange their size.

C # Selection Statement Exercise 1

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.