C # Exercises

Source: Internet
Author: User

Prompts the user to enter age, if greater than or equal to 18, tells the user to be able to view, if less than 10 years old, tells not allow to view, if greater than or equal to 10 years old and less than 18, prompts the user whether to continue viewing (yes, no), if the input is yes prompt the user to see, otherwise prompt"quit, you give up view". Console.WriteLine ("Please enter the age of the user"); intA =Convert.ToInt32 (Console.ReadLine ()); if(A >= -) {Console.WriteLine ("users can view"); }           Else if(A < -) {Console.WriteLine ("not allowed to view"); Console.WriteLine ("If you want to view, please enter Yes or no to view"); stringb =Console.ReadLine (); if(b = ="Yes") {Console.WriteLine ("did you see that, Charlie?"); }               Else if(b = ="No") {Console.WriteLine ("you give up viewing"); }} console.readkey ();

C # Exercises

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.