Question: Please help write it in java. Write a recursive program to solve the following problem: P(1) 3 P(2)4 P(n) P(n-1) + P(n-2) for n>2 To

Please help write it in java.
Write a recursive program to solve the following problem: P(1) 3 P(2)4 P(n) P(n-1) + P(n-2) for n>2 To test your algorithm the output for P(4) 11 and P(7) 47 You can write this in pseudocode or the language of your choice. The main program shall call a function int par(int n) t returns 3 if n1 It returns 4 if n 2 It returns par(n-1) +par(n-2) if n> 2 What you will turn in for a grade. 1. Provide your commented code 2. Provide a screenshot of your output for n 5 or P
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
