Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 382 Bytes

File metadata and controls

12 lines (9 loc) · 382 Bytes

Problem 11: The Digital Root (Sum of Digits)

Problem Statement

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. Implement this using recursion.

Input Format

  • A non-negative integer num.

Example

Input: num = 38
Output: 2
Explanation: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.