Advertisement
desislava_topuzakova

02. Days of week

Mar 5th, 2023
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _01._Day_Of_Week
  4. {
  5. internal class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int number = int.Parse(Console.ReadLine());
  10. //[1...7]
  11. //1 -> Monday
  12. //2 -> Tuesday
  13. //3 -> Wednesday
  14. //4 -> Thursday
  15. //5 -> Friday
  16. //6 -> Saturday
  17. //7 -> Sunday
  18. // < 1 ΠΈΠ»ΠΈ > 7 -> Invalid day!
  19.  
  20. string[] daysOfWeek = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
  21.  
  22.  
  23. if (number < 1 || number > 7)
  24. {
  25. Console.WriteLine("Invalid day!");
  26. }
  27. else
  28. {
  29. //number Π΅ [1; 7]
  30. Console.WriteLine(daysOfWeek[number - 1]);
  31. }
  32. }
  33. }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement