Question: ALL CODE MUST BE WRITTEN USING RECURSION * Write a method called countdown(int num), it should print out every number from num to 0. *
ALL CODE MUST BE WRITTEN USING RECURSION
* Write a method called countdown(int num), it should print out every number from num to 0.
* Write a method, called sumDigits(int n). Given a non-negative int n, return the sum of its digits recursively (no loops).
sumDigits(126) 9 sumDigits(49) 13 sumDigits(12) 3
*
Given base and n that are both 1 or more, compute recursively the value of base to the n power, so powerN(3, 2) is 9 (3 squared).
powerN(3, 1) 3
powerN(3, 2) 9
powerN(3, 3) 27
*
Write a method, count7(int). Given a non-negative int n, return the count of the occurrences of 7 as a digit, so for example 717 yields 2. (no loops).
count7(717) 2
count7(7) 1
count7(123) 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
