Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace AgeAfter10Years
- {
- class AgeAfter10Years
- {
- static void Main(string[] args)
- {
- DateTime birthDay = DateTime.Parse(Console.ReadLine()); // Input data in format "dd.mm.yyyy"
- DateTime currDay = DateTime.Now; // Get current Date and Time from the system
- TimeSpan result = currDay - birthDay; // Calculate the difference between current day and birth day. The result is days.
- double currentAge = Math.Truncate(result.TotalDays / 365.25D); // Convert from days to years
- // output
- Console.WriteLine("Now: {0}", currentAge );
- Console.WriteLine("After 10 years: {0}",currentAge + 10);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment