Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Problem 15.* Age after 10 Years
- //Write a program to read your birthday from the console and print how old you are now and how old you will be after 10 years.
- using System;
- class AgeAfter10Years
- {
- static void Main()
- {
- Console.WriteLine("Please, enter your born year:");
- int bornYear = int.Parse(Console.ReadLine());
- int currentYear = DateTime.Now.Year;
- //Your Age Now
- int nowAge = currentYear - bornYear;
- //Your Age after 10 years
- int afterAge = nowAge + 10;
- //Print to Console your age now and after 10 years
- Console.WriteLine("Your age now is {0} and after 10 years you will be on {1} years.", nowAge, afterAge);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement