#K10706. Calculate the Next Day of the Week
Calculate the Next Day of the Week
Calculate the Next Day of the Week
You are given two integers: starting_day
and days_to_add
. The integer starting_day
represents a day of the week, where 0 corresponds to Sunday, 1 to Monday, up to 6 corresponding to Saturday. Your task is to compute the day of the week after adding a given number of days.
The relationship can be expressed by the formula:
$$ new\_day = (starting\_day + days\_to\_add) \mod 7 $$
Return the name of the day as a string. For example, if starting_day
is 0 (Sunday) and days_to_add
is 5, the next day is Friday
.
inputFormat
The input consists of a single line containing two space-separated integers:
starting_day
(an integer between 0 and 6 inclusive)days_to_add
(a non-negative integer)
outputFormat
Output a single line containing the name of the day of the week after adding days_to_add
days. The day names are: Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday.
6 0
Saturday