Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- using System.Security.Policy;
- using System.Text.RegularExpressions;
- namespace ConsoleTests
- {
- class ConsoleTests
- {
- static void Main()
- {
- string dateStart = Console.ReadLine();
- string dateEnd = Console.ReadLine();
- DateTime start = DateTime.ParseExact(dateStart, "d.M.yyyy", CultureInfo.InvariantCulture);
- DateTime end = DateTime.ParseExact(dateEnd, "d.M.yyyy", CultureInfo.InvariantCulture);
- int count = 0;
- for (DateTime i = start; i <= end; i=i.AddDays(1))
- {
- if (i==end)
- {
- Console.WriteLine("Distance: {0} days",count);
- return;
- }
- else
- {
- count++;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment