Question: 1 (18 points) int bunnyEars(int n ) returns 1 if n is less than 0 , otherwise returns the number of ears for n bunnies.

1 (18 points) int bunnyEars(int n ) returns 1 if n is less than 0 , otherwise returns the number of ears for n bunnies. 2. (18 points) int factorial(int n ) returns 1 if n is less than 0 , otherwise returns the factorial of n 3. (18 points) int fib(int n ) returns 1 if n is less than 0 , returns 0 if n is 0 , returns 1 if n is 1 , otherwise returns fib of n - 1 plus fib of n - 2. (If you test this with numbers greater than about 50 , it will be very slow.) 4. (18 points) int posPow(int base, int exp) returns 1 if exp is less than 0 , otherwise returns base raised to the power exp. 5. (18 points) int numDigits(int n ) returns the number of digits in n. Hint: in C, as in Java, int division returns an int; any digits that would be after the decimal point are lost, so that, for example, 5/4 is 1. 6. (10 points) Write a main() that tests all the other functions thoroughly. Turn in your code and a .txt file with a copy and paste of the output from running your program
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
