Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class DateAfterTenYears
- {
- static void Main()
- {
- Console.Write("Add birth date (dd.mm.yyyy)");
- string birthDay = Console.ReadLine();
- //-------------------------------------------------------------
- //Get year from birthday
- string getYear = birthDay.Substring(6);
- int convYear = int.Parse(getYear);
- //-------------------------------------------------------------
- //Get time now
- DateTime Today=DateTime.Today;
- //Get year (now)
- string strYear = Convert.ToString(Today);
- string container1 = strYear.Substring(strYear.Length - 13);
- string todayYear = container1.Substring(0,4);
- int convTodayYear = int.Parse(todayYear);
- //-------------------------------------------------------------
- int yearsNow = convTodayYear - convYear;
- Console.WriteLine("You're {0} years old.",yearsNow);
- int yearsAfter = yearsNow + 10;
- Console.WriteLine("After ten years you will be {0} years old.",yearsAfter);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement