grach

1000 Days After Birth

Jul 7th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 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 _1000_Days_After_Birth
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             var date = Console.ReadLine();
  15.             string format = "dd-MM-yyyy";
  16.  
  17.             var resultingDate = DateTime.ParseExact(date, format, null);
  18.             resultingDate = resultingDate.AddDays(999);
  19.  
  20.             var day = resultingDate.Day;
  21.             var month = resultingDate.Month;
  22.             var year = resultingDate.Year;
  23.  
  24.  
  25.             Console.WriteLine($"{day}-{month}-{year}");
  26.  
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment