Question: this is for java program 3 small program Factorial of an integer n if n 0, then factorial(n) 1 if n > 0, then factorial(n)
this is for java program 3 small program


Factorial of an integer n if n 0, then factorial(n) 1 if n > 0, then factorial(n) = n * factorial(n-1) a) 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. b) Fibonacci series 0,1,1,2,3,5,8,13,21,34. if n-0, then fib(n)-0 //base case if n= 1, then fib(n)-1 //base case if n>1, then fib(n) fib(n-1) + fib(n-2) Write a recursive method public static int fib(int n) that finds the nth number in the Fibonacci series
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
