Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Globalization;
- namespace _13.Debug_the_Code_Holidays_Between_Two_Dates
- {
- class Program
- {
- static void Main(string[] args)
- {
- {
- var startDate = DateTime.ParseExact(Console.ReadLine(),
- "d.M.yyyy", CultureInfo.InvariantCulture);
- var endDate = DateTime.ParseExact(Console.ReadLine(),
- "d.M.yyyy", CultureInfo.InvariantCulture);
- var holidaysCount = 0;
- for (var 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