Q. Write a PL/SQL block to obtain Fibonacci series.
Answer:
Fibonacci series: It is a series of a numbers, in which each number is the sum of two previous numbers.
For example:
1, 1, 2, 3, 5, 8, 13, 21.........etc.
The following code will calculate the Fibonacci series of a given number.
Output:

Answer:
Fibonacci series: It is a series of a numbers, in which each number is the sum of two previous numbers.
For example:
1, 1, 2, 3, 5, 8, 13, 21.........etc.
The following code will calculate the Fibonacci series of a given number.
declare
a number(3):=1;
b number(3):=1;
c number(3);
n number(3):=&n;
begin
Dbms_output.put_line('the fibinocci series is:');
while a<=n
loop
dbms_output.put_line(a);
c:=a+b;
a:=b;
b:=c;
end loop;
end;
/
Output:



