Posted: Tue Oct 7
Due: Wednesday 10/8 10:00am
Submission name: work12.rkt
For each of these functions do the following:
- Write a function contract.
- Define the function.
- Include, in comments, s trace diagram that has at least 3 recursive calls on the stack before the base case is reached.
sumDigitis- Takes a single nonnegative integer parameter.
- Returns the sum of all the digits of that parameter.
numDigitis- Takes a single nonnegative integer parameter.
- Returns the number of all the digits of that parameter.
fibonacci- Takes a single nonnegative integer parameter (
n). - Returns the
nth value of the fibonacci series. - The
nth value of the fibonacci series is the sum of the previous two values in the series. \(fib(n) = fib(n - 1) + fib(n - 2)\) - The first and second values are
1.
- Takes a single nonnegative integer parameter (