Exercise 3: Sum of Digits Using Recursion

Let's calculate the sum of digits of a number by using recursion.

Problem Statement

In this exercise, you have to write a function digitSum that calculates the sum of digits of a number using recursion.

Sample input

Create a free account to access the full course.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy