Days of the week are numbered 0 (Sunday) to 6 (Saturday), and hours 0 to 23. ClockMath reads today's day number, a number of days ahead, the current hour and a number of hours ahead, and prints:
- the day number after those days:
(today + daysAhead) % 7; - how many full weeks lie in between:
daysAhead / 7; - the hour after those hours, and how many days later that is.
For the input
2 10 22 5
the program prints
Day number in 10 days: 5
Full weeks in between: 1
Hour in 5 hours: 3
That is 1 day(s) later