Advertisement
KristianIvanov00

Task03_Homework4

Mar 12th, 2023
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Task03
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. String EGN = Console.ReadLine();
  10. int year = int.Parse(EGN.Substring(0, 2));
  11. int month = int.Parse(EGN.Substring(2, 2));
  12. int day = int.Parse(EGN.Substring(4, 2));
  13. if (month > 20 && month <= 32)
  14. {
  15. year += 1800;
  16. month = month - 20;
  17. }
  18. else if (month > 40 && month <= 52)
  19. {
  20. year += 2000;
  21. month = month - 40;
  22. }
  23. else
  24. {
  25. year += 1900;
  26. }
  27.  
  28.  
  29. DateTime date = new DateTime(year, month, day);
  30. if (day < 10)
  31. {
  32. Console.Write($"0" + day + ".");
  33. }
  34. else
  35. {
  36. Console.Write(day + ".");
  37. }
  38.  
  39. if (month < 10)
  40. {
  41. Console.Write($"0" + month + ".");
  42. }
  43. else
  44. {
  45. Console.Write(month + ".");
  46. }
  47.  
  48. Console.WriteLine(year);
  49. Console.WriteLine(date.DayOfWeek);
  50.  
  51.  
  52. }
  53. }
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement