2, the student's completion test performance evaluation, the request in the console prompts the user to enter the student examination result, writes a method, according to the user input result, returns a rank;
90 points above A grade, 80~90 B grade, 70~80 grade C, 60~70 B grade, 60 points below C class.
:
using system;using system.collections.generic;using System.Linq;using System.text;namespace consoleapplication1{class Program {static void Main (string[] args) { Console.WriteLine ("Please enter your test results:"); int score =convert.toint32 (Console.ReadLine ()); Switch (SCORE/10) {case 10:console.writeline ("very good!") "); Break Case 9:console.writeline ("excellent"); Break Case 8:console.writeline ("excellent"); Break Case 7:console.writeline ("good"); Break Case 6:console.writeline ("Pass"); Break Default:Console.WriteLine ("the inferior lattice! "); Break } console.readline (); } }}
3, in the console prompts the user to enter an age, if the user enters the age is more than 18 years old, prompts the user "can view", if is less than 10 years old, prompts the user "cannot view", if is between 10 years old to 18 years old, prompts the user "whether continues to view?" (yes/no), if the user enters Yes, the prompt can be viewed, otherwise the prompt cannot be viewed.
:
using system;using system.collections.generic;using System.Linq;using System.text;namespace consoleapplication1{class Program {static void Main (string[] args) { Console.WriteLine ("Please enter your Age:"); int Age =convert.toint32 (Console.ReadLine ()); if (age>=) {Console.WriteLine ("Can be viewed! "); } if (age < x && age >=) {Console.WriteLine ("See Please enter Y, do not look at input n"); String str = Console.ReadLine (); if (str = = "Y" | | str = = "Y") {Console.WriteLine ("Force View"); } else {Console.WriteLine ("88"); }} if (age <) {Console.WriteLine ("Too Young to view"); } console.readline (); } }}
4. In the console, prompt the user to enter a year, and then prompt the user to enter a month, depending on the year and month entered by the user to output the number of days of the month (need to determine whether it is leap years).
:
Using system;using system.collections.generic;using system.linq;using system.text;namespace ConsoleApplication1{ Class Program {static void Main (string[] args) {Console.WriteLine ("Please enter an annual"); int year = Convert.ToInt32 (Console.ReadLine ()); Console.WriteLine ("Please enter the month"); int month = Convert.ToInt32 (Console.ReadLine ()); if (month = = 2) {if (year% 4 = = 0) {Console.WriteLine ("{0} years { 1} months with 29 days ", year, month); }} else {int[] arr = new int[] {1, 3, 5, 7, 8, 10, 12}; if (Array.indexof (arr, month)) = =-1) {Console.WriteLine ("{0} year {1} month 3 0 days ", year, month); } else {Console.WriteLine ("{0} years {1} months have 31 days", year, month); }} console.readline (); } }}
Intelligence Podcast. NET training Employment class Entrance test questions