Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main()
- {
- Console.WriteLine("Enter you birthday: DD.MM.YYYY");
- string birthDay = Console.ReadLine();
- string userYear = birthDay.Substring(6, 4);
- int userYearInt = int.Parse(userYear);
- DateTime currentYear = new DateTime(DateTime.Now.Year);
- int currentYearInt = int.Parse(currentYear.ToString("yyyy"));
- int userAge = 0;
- userAge = currentYearInt - userYearInt;
- Console.WriteLine("User age is: {0}", userAge);
- }
Advertisement
Add Comment
Please, Sign In to add comment