Sum of digits (Recursion)
Problem Statement
Given a number N, find the sum of all the digits of the number
Note: Use a recursive method to solve this problem.
Note: Use a recursive method to solve this problem.
static long Sum(long n)
{ long sum = 0;
while (n != 0) {
sum = sum + n % 10;
n = n / 10;
}
return sum;
}