Advertisement
Guest User

DayOfWeek

a guest
Nov 12th, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace DayOfWeek
  9. {
  10. class Program
  11. {
  12. static void Main(string[] args)
  13. {
  14. int numDay = int.Parse(Console.ReadLine());
  15.  
  16. Console.WriteLine(numDay > 7 || numDay < 1 ? "error"
  17. : DateTime.ParseExact($"{numDay}/08/2016", "d/MM/yyyy", CultureInfo.InvariantCulture).DayOfWeek.ToString());
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement