Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace LawfulAge
- {
- class Program
- {
- static void Main(string[] args)
- {
- string inputFormat = "d-M-yyyy";
- string outputFormat = "dd-MM-yyyy";
- string inputString = Console.ReadLine();
- DateTime dateOfBirth = DateTime.ParseExact(inputString, inputFormat, System.Globalization.CultureInfo.InvariantCulture);
- int yearsToAdd = 18;
- DateTime dateWithAddedYears = dateOfBirth.AddYears(yearsToAdd);
- Console.WriteLine(dateWithAddedYears.ToString(outputFormat));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment