Dsa
Recursion
Warm-up
Sum of Digits
Write a function that takes a non-negative integer and returns the sum of its digits. Implement the solution using recursion. For example, given the input '123', the output should be '6'.
Example Input:
123
Example Output:
6
Key concepts
recursionbasic math
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now