Advertisement
Blagovest

HolidaysBetweenTwoDates

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