Cody

Problem 44668. Day counter function

Solution 2184578

Submitted on 31 Mar 2020 by Nikolaos Nikolaou
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
year = 1902; foms_correct = 2; assert(isequal(day_counter( year ),foms_correct))

l = 4 l = 4 7 l = 4 7 7 l = 4 7 7 3 l = 4 7 7 3 5 l = 4 7 7 3 5 1 l = 4 7 7 3 5 1 3 l = 4 7 7 3 5 1 3 6 l = 4 7 7 3 5 1 3 6 2 l = 4 7 7 3 5 1 3 6 2 4 l = 4 7 7 3 5 1 3 6 2 4 7 l = 4 7 7 3 5 1 3 6 2 4 7 2 foms = 2

2   Pass
year = 2002; foms_correct = 2; assert(isequal(day_counter( year ),foms_correct))

l = 3 l = 3 6 l = 3 6 6 l = 3 6 6 2 l = 3 6 6 2 4 l = 3 6 6 2 4 7 l = 3 6 6 2 4 7 2 l = 3 6 6 2 4 7 2 5 l = 3 6 6 2 4 7 2 5 1 l = 3 6 6 2 4 7 2 5 1 3 l = 3 6 6 2 4 7 2 5 1 3 6 l = 3 6 6 2 4 7 2 5 1 3 6 1 foms = 2

3   Pass
year = 1996; foms_correct = 3; assert(isequal(day_counter( year ),foms_correct))

l = 2 l = 2 5 l = 2 5 6 l = 2 5 6 2 l = 2 5 6 2 4 l = 2 5 6 2 4 7 l = 2 5 6 2 4 7 2 l = 2 5 6 2 4 7 2 5 l = 2 5 6 2 4 7 2 5 1 l = 2 5 6 2 4 7 2 5 1 3 l = 2 5 6 2 4 7 2 5 1 3 6 l = 2 5 6 2 4 7 2 5 1 3 6 1 foms = 3

4   Pass
year = 1885; foms_correct = 1; assert(isequal(day_counter( year ),foms_correct))

l = 5 l = 5 1 l = 5 1 1 l = 5 1 1 4 l = 5 1 1 4 6 l = 5 1 1 4 6 2 l = 5 1 1 4 6 2 4 l = 5 1 1 4 6 2 4 7 l = 5 1 1 4 6 2 4 7 3 l = 5 1 1 4 6 2 4 7 3 5 l = 5 1 1 4 6 2 4 7 3 5 1 l = 5 1 1 4 6 2 4 7 3 5 1 3 foms = 1

Suggested Problems

More from this Author29

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!