Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class AgeAfter10Years
- {
- static void Main()
- {
- Console.Write("Enter your birth date: ");
- DateTime bDay = DateTime.Parse(Console.ReadLine());
- DateTime now = DateTime.Now;
- int age = now.Year - bDay.Year;
- if (now < bDay.AddYears(age))
- {
- age--;
- }
- Console.WriteLine("You are {0} years old.", age);
- Console.WriteLine("After 10 years you will be {0} years old.", age + 10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement