Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Globalization;
- namespace HolidaysBetweenTwoDates
- {
- class Program
- {
- static void Main(string[] args)
- {
- DateTime startDate = DateTime.ParseExact(Console.ReadLine(), "d.M.yyyy", CultureInfo.InvariantCulture);
- DateTime endDate = DateTime.ParseExact(Console.ReadLine(), "d.M.yyyy", CultureInfo.InvariantCulture);
- int holidaysCount = 0;
- for (DateTime date = startDate; date <= endDate; date = date.AddDays(1))
- {
- if (date.DayOfWeek == DayOfWeek.Saturday || date.DayOfWeek == DayOfWeek.Sunday)
- {
- holidaysCount++;
- }
- }
- Console.WriteLine(holidaysCount);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment