PL/SQL Program for Fibonacci Series

PL/SQL Program for Fibonacci Series:

declare
no number;
a number:=-1;
b number:=1;
c number:=0;
begin
no:=:no;
dbms_output.put_line('Fibonacci Series is : ');
for i in 1..no
loop
c:=a+b;
a:=b;
b:=c;
dbms_output.put_line('   '||c);
end loop;
end;

OUTPUT:

Fibonacci Series is : 
   0
   1
   1
   2
   3
   5
   8
   13

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.