Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Write a program that reads two dates in the format: day.month.year and calculates the number of days between them. */
- namespace EX16.BetweenTwoDate
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class BetweenTwoDate
- {
- static void Main(string[] args)
- {
- int count = 0;
- DateTime firstDate = DateTime.Parse("27.02.2006");
- DateTime secondDate = DateTime.Parse("3.03.2004");
- while (firstDate.Day != secondDate.Day)
- {
- firstDate = firstDate.AddDays(1);
- count++;
- }
- Console.WriteLine("Distance : {0}",count);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement