Write a PL/SQL block to display following series
1 1 2 3 5 8 ..... N
DECLARE
term1 number;
term2 number;
term3 number;
n number;
BEGIN
n:=&n;
term1:=1;
term2:=0;
term3:=1;
FOR i in 1..n
LOOP
dbms_output.put_line(term3||' ');
term1:=term2;
term2:=term3;
term3:=term1+term2;
END LOOP;
END;
No comments:
Post a Comment