Count Sundays
Learn to write a code for counting Sundays during the twentieth century.
We'll cover the following...
Challenge
January 1st, 1900 was a Monday. The months April, June, September, and November have 30 days, whereas the rest have 31 days, except February which has 29 or 28 depending on whether the year is a leap year or not. A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400. Write a program to find out how many Sundays fell on the first of the month during the twentieth century (January 1st, 1901 to December 31st, 2000)?
Note: It ...
Access this course and 1400+ top-rated courses and projects.