Question: Please use java to finish this program. Exercise 1: These are recursive programs discussed in the lectures. a) Fibonacci series 0,1,1,2,3,5,8,13,21,34, ifn-0, then fib(n)=0 //base

Please use java to finish this program.
Exercise 1: These are recursive programs discussed in the lectures. a) Fibonacci series 0,1,1,2,3,5,8,13,21,34, ifn-0, then fib(n)=0 //base case if n--1, then fib(n)-1 //base case if n> I, then fib(n) = fib(n-l ) + fib(n-2) Write a recursive method public static int fib(int n) that finds the nth number in the Fibonacci series Use this method in the main method to print the first 20 numbers in the Fibonacci series. b) Factorial of an integer n if n-0, then factorial(n)= 1 if n > 0, then factorial(n) = n * factorial(n-1) Write a recursive method public static int factorial (int n) that finds factorial of a non-negative integer n. Use this method in the main method to print the factorials of 1 to 10. x to the power n if n0, then power(x,n)1 if n>0, then power(x,n) = power(x,n-1)*x c) Write a recursive method public static int power(int x, int n) that finds the x to the power n, where x and n are positive integers. Use this method in the main method that prompts the user to enter x and n and prints x to the power of n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
