Question: PLPSQL FUNCTION Write a function named fibonacci that, given an integer i (as the 1st and only parameter), returns the i-th Fibonacci number . The
PLPSQL FUNCTION
Write a function named fibonacci that, given an integer i (as the 1st and only parameter), returns the i-th Fibonacci number.
The valid range of i is [0, 1000] in our project.
Note that the first Fibonacci number is F(0) = 0, and we have F(1) = 1, then you can use the formula F(i) = F(i-1) + F(i-2) to get the output for other inputs. If the parameter i is out of range, your function should return -1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
