Who doesn't like to chill on a Sunday morning in summer with a chilled beer and TV or in winter playing badminton or ultimate with friends?
I always think knowing how many days you have to chill in a month keeps you well-informed and helps you plan what you want to do. Be it sitting in front of your pc and solving a code-golf problem or going out to play football.
So, help me write a program or function which takes as input 2 positive integers,
M and outputs the number of Sundays in that particular year(
Y) and month(
M) (according to the Gregorian Calendar), followed by the date of each Sunday.
Also, do keep in mind that the shortest code wins.
1000 <= Y <= 9999
1 <= M <= 12
These test cases will have output will have the dates of each Sunday of that month in that year in the format
Sample Test Cases
Test Case 1
5 01-01-2017 08-01-2017 15-01-2017 22-01-2017 29-01-2017
Test Case 2
4 04-02-2018 11-02-2018 18-02-2018 25-02-2018
Test Case 3
4 06-11-2016 13-11-2016 20-11-2016 27-11-2016