Take a non-negative integer and add up its digits. If the result has more than one digit, add up its digits again, and keep going until a single digit remains. Write digital_root(n) that returns that final single digit.
Examples
Input: n = 493
Output: 7
Explanation: 4 + 9 + 3 = 16, then 1 + 6 = 7.
Input: n = 9
Output: 9
Constraints
0 <= n <= 10**18
Goals
- Nest a digit-summing loop inside an outer repeat-until loop
- Recognise when a repeated process has reached its stopping point