Due: Wednesday, November 28
Goal: Explore recursion
Write a recursive method with the following definition:
public static int sumDigits(int n)
sumDigits takes as input a non-negative int n and returns the sum of its digits recursively (no loops). Note that mod (%) by 10 yields the rightmost digit (126 % 10 is 6), while divide (/) by 10 removes the rightmost digit (126 / 10 is 12).
For example:
Before you start coding figure out the base condition (when recursion ends) and how recursion will be used to sum the digits.
Show or email your completed program to kenrick@uaa.alaska.edu by the end of the day.