NedyalkoKikov

WeekInDays

May 8th, 2016
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace DaysInWeekWithArrays
  8. {
  9. class DaysInWeekwithArrays
  10. {
  11. static void Main()
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. Week(n);
  15. }
  16.  
  17. public static int Week(int n)
  18. {
  19. string[] WeekDays = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };
  20.  
  21. if (n >= 1 && n <= 7)
  22. {
  23. string d = WeekDays[n - 1];
  24. Console.WriteLine(d);
  25. }
  26. else
  27. {
  28. Console.WriteLine("Invalid Day");
  29. }
  30. return n;
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment