Guest User

Untitled

a guest
May 20th, 2015
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.75 KB | None | 0 0
  1. using System;
  2. class AgeAfter10Years
  3. {
  4.     static void Main()
  5.     {
  6.         Console.Write("Enter Your Birthday: ");
  7.         string input = Console.ReadLine();
  8.         DateTime birthDate = Convert.ToDateTime(input);
  9.         DateTime today = DateTime.Now;
  10.         int birthYear = birthDate.Year;
  11.         int todayYear = today.Year;
  12.         TimeSpan diff = today.Subtract(birthDate);
  13.         DateTime date0 = new DateTime().Add(diff);
  14.         int yearsOld = date0.Year - 1;
  15.  
  16.         Console.WriteLine("Today we are: {0}", todayYear);
  17.         Console.WriteLine("Your birthday year is: {0}", birthYear);
  18.         Console.WriteLine("You are {0} years old.", yearsOld);
  19.         Console.WriteLine("After 10 years you will be {0} years old", yearsOld+10);
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment