Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace DateAndTime
- {
- class AgeNowAndAfter10
- {
- static void Main()
- {
- Console.Write(" Insert Your birth day /dd.mm.yyyy/ : ");
- DateTime birthDay = DateTime.Parse(Console.ReadLine());
- DateTime curentDay = DateTime.Now;
- int marker = 0;
- if (birthDay.Month > curentDay.Month)
- {
- marker = 1;
- }
- if (birthDay.Month == curentDay.Month && birthDay.Day > curentDay.Day)
- {
- marker = 1;
- }
- int curentYear = birthDay.Year;
- int yearOfBirth = curentDay.Year;
- int myAgeNow = yearOfBirth - curentYear;
- int myAgeAfterTenYears = myAgeNow + 10;
- Console.WriteLine(" My age now : " + (myAgeNow - marker));
- Console.WriteLine(" My age after 10 years : " + (myAgeAfterTenYears - marker));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment