Month Offset

Write a function to give you the "month offset" given a number representing the month. You can get the month offset from the following table:

MonthMonth offset
11
24
34
40
52
65
70
83
96
101
114
126
anything else-1

Of course, here's the main() to test your function.

Offset for month 1: 1
Offset for month 2: 4
Offset for month 3: 4
Offset for month 4: 0
Offset for month 5: 2
Offset for month 6: 5
Offset for month 7: 0
Offset for month 8: 3
Offset for month 9: 6
Offset for month 10: 1
Offset for month 11: 4
Offset for month 12: 6
Offset for month 43: -1


©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License