Quantcast
Channel: The Crazy Programmer
Viewing all articles
Browse latest Browse all 761

PL/SQL Program for Fibonacci Series

$
0
0

Here you will get pl/sql program for fibonacci series.

It is a series in which next number is the sum of previous two numbers.

 

PL/SQL Program for Fibonacci Series

declare
	first number:=0;
	second number:=1;
	third number;
	n number:=&n;
	i number;

begin
	dbms_output.put_line('Fibonacci series is:');
	dbms_output.put_line(first);
	dbms_output.put_line(second);	

	for i in 2..n
	loop
		third:=first+second;
		first:=second;
		second:=third;
		dbms_output.put_line(third);
	end loop;
end;
/

 

Output

Enter value for n: 6
old 5: n number:=&n;
new 5: n number:=6;
Fibonacci series is:
0
1
1
2
3
5
8

The post PL/SQL Program for Fibonacci Series appeared first on The Crazy Programmer.


Viewing all articles
Browse latest Browse all 761

Trending Articles