Link Search Menu Expand Document

Days in a Month

Consider the code for printing the number of days in a given month for a given year: https://github.com/sarustamyan/technolab-csharp-sources/blob/master/Homework/Lesson1/DaysInAMonth/Program.cs

Is it going to work correctly for any month/year combination? Find the bug in the code and fix it.

Bonus Points: Clone the repository the code is in using Git instead of copy-pasting.

Hint 1: The year variable is declared but not used. Coincidence?

Hint 2: You'll need to find a way to figure out if a given number is divisible by another number. You'll need the remainder operator for that.

Hint 3: Are you sure we considered all the use cases? Note that it takes Earth 365.2422 days to circle around the sun.