Question: 1 . Write a method ` int sumOfDigits ( int n ) ` that recursively sums the digits of ` n ` . 2 .
Write a method int sumOfDigitsint n that recursively sums the digits of n
Base case: If n is less than return nsince a singledigit number is its sum
Write a main method to test the sum of digits with different inputs.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
