Problem 44668. Day counter function
Write a function called day_counter that returns the number of Mondays that fell on the first day of the month in a given year between 1776 and 2016 inclusive where the requested year is the only input to your function and it is a positive integer scalar. Note that a leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400. In a leap year, February has 29 days.
You are not allowed to use the datenum built-in function.
(Inspired by Project Euler.)
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers55
Suggested Problems
-
Return the 3n+1 sequence for n
8355 Solvers
-
Find common elements in matrix rows
2668 Solvers
-
1704 Solvers
-
10836 Solvers
-
How Many Months Until It's Today Again?
110 Solvers
More from this Author29
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!