Advertisement
KodingKid

C# input: selection of the day - Basic Scripting #26

Jun 22nd, 2021
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.73 KB | None | 0 0
  1. input_day = Console.ReadLine();
  2. input_day = int day;
  3. if (input_day > 7)
  4. {
  5.     Console.WriteLine("Sorry, this input is too high, try entering an input between 1 and 7!");
  6.     break;
  7. }
  8. if (input_day < 1)
  9. {
  10.     Console.WriteLine("Sorry, this input is too low, try entering an input between 1 and 7!");
  11.     break;
  12. }
  13. switch (day)
  14. {
  15.   case 1:
  16.     Console.WriteLine("Monday");
  17.     break;
  18.   case 2:
  19.     Console.WriteLine("Tuesday");
  20.     break;
  21.   case 3:
  22.     Console.WriteLine("Wednesday");
  23.     break;
  24.   case 4:
  25.     Console.WriteLine("Thursday");
  26.     break;
  27.   case 5:
  28.     Console.WriteLine("Friday");
  29.     break;
  30.   case 6:
  31.     Console.WriteLine("Saturday");
  32.     break;
  33.   case 7:
  34.     Console.WriteLine("Sunday");
  35.     break;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement