Advertisement
RadoNeshev

AgeIn10Years

Mar 18th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. using System;
  2.  
  3. class Program
  4. {
  5.     static void Main()
  6.     {
  7.         Console.Write("Enter your birthday in format(dd.mm.yyyy): ");
  8.         DateTime userBirthday = DateTime.Parse(Console.ReadLine());
  9.         long result = DateTime.Today.Subtract(userBirthday).Ticks;
  10.         Console.WriteLine("You are {0} years old.", new DateTime(result).Year - 1);
  11.         Console.WriteLine("In 10 years you will be {0} years old.", new DateTime(result).AddYears(10).Year - 1);
  12.     }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement