Write a recursive function digitSum(n: Int): Int, which calculates the sum of all the digits in n.
Recursion
Programming a recursive function: calculate the sum of all the digit
Report a typo
Sample Input 1:
5421Sample Output 1:
12Write a program in Kotlin
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.