Created
October 17, 2021 08:29
-
-
Save nameofSEOKWONHONG/1e60884b5479f216596da7802d7ebe6b to your computer and use it in GitHub Desktop.
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
// See https://aka.ms/new-console-template for more information | |
Enumerable.Range(2021, 10).ToList().ForEach(year => { | |
Console.WriteLine($"==================={year}년================="); | |
Enumerable.Range(1, 12).ToList().ForEach(month => { | |
Console.WriteLine($"============={month}월=============="); | |
var sday = new DateTime(year, month, 1); | |
var eday = sday.AddMonths(1).AddDays(-1); | |
int correctCnt = 0; | |
for(var i=eday.AddDays(-7); i<=eday; i = i.AddDays(1)) { | |
if(correctCnt == 0 && i.DayOfWeek == DayOfWeek.Wednesday) continue; | |
if(i.DayOfWeek == DayOfWeek.Wednesday) { | |
Console.WriteLine($"매월 마지막주 수요일 일자는:{i.ToString()}, {i.DayOfWeek.ToString()}"); | |
correctCnt = 0; | |
return; | |
} | |
correctCnt+= 1; | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment