Created
July 5, 2016 08:18
-
-
Save Nikola-Andreev/f133647b44e64f5a74094260185d98e8 to your computer and use it in GitHub Desktop.
Holidays between two dates.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Numerics; | |
using System.Globalization; | |
namespace Praktice | |
{ | |
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); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment