Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class TenYearsFromNow
- {
- static void Main()
- {
- Console.WriteLine("Please enter your birth year below...");
- int startingYear = 1900;
- int nowadays = DateTime.Now.Year;
- int birthYear = int.Parse(Console.ReadLine());
- int currentAge = (nowadays - birthYear);//Calculates the current age.
- int inTenYears = currentAge + 10;// Calculates the age ten years from now.
- //Let's check if the year people enter is correct.
- if (birthYear >= startingYear && birthYear < nowadays)
- {
- //Let's print out the current age:
- Console.WriteLine("You are now " + currentAge + " Years Old");
- //Let's print out the age 10 years from now:
- Console.WriteLine("10 Years from now you will be: " + inTenYears + " Years Old");
- }
- else
- {
- Console.WriteLine("Sorry pal!!! You either entered a wrong Birth Year or you're too old to look in the next 10 years :) !!!");
- }
- Console.WriteLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement