Advertisement
Ronka

Untitled

Jun 7th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System;
  2. using System.Globalization;
  3.  
  4. class HolidaysBetweenTwoDates
  5. {
  6. static void Main()
  7. {
  8. var startDate = DateTime.ParseExact(Console.ReadLine(),
  9. "d.M.yyyy", CultureInfo.InvariantCulture);
  10. var endDate = DateTime.ParseExact(Console.ReadLine(),
  11. "d.M.yyyy", CultureInfo.InvariantCulture);
  12. int holidaysCount = 0;
  13. for (var date = startDate; date <= endDate; date=date.AddDays(1))
  14. {
  15. if (date.DayOfWeek == DayOfWeek.Saturday ||
  16. date.DayOfWeek == DayOfWeek.Sunday)
  17. {
  18. holidaysCount++;
  19. }
  20.  
  21. }
  22.  
  23. Console.WriteLine(holidaysCount);
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement