Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 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 _13._1000_Days_After_Birth
  9. {
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.  
  15.             // normal solution
  16.  
  17.             string str = Console.ReadLine();
  18.             DateTime date = DateTime.ParseExact(str, "dd-MM-yyyy", CultureInfo.InvariantCulture);
  19.             date = date.AddDays(999);
  20.             Console.WriteLine(date.ToString("dd-MM-yyyy"));
  21.  
  22.  
  23.             // one line solution
  24.  
  25.             //Console.WriteLine(
  26.             //     DateTime.ParseExact(Console.ReadLine(), "dd-MM-yyyy", CultureInfo.InvariantCulture).AddDays(999).ToString("dd-MM-yyyy")        
  27.             //    );
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement