FIND THE FIBONACII SERIES
DECLARE
I NUMBER(3):=1;
J NUMBER(3):=0;
L NUMBER(2):=&L;
BEGIN
DBMS_OUTPUT.PUT_LINE('FIBONACII SERIES UP TO '||L||'TH LIMIT IS: ');
FOR K IN 1..L
LOOP
DBMS_OUTPUT.PUT_LINE(J);
J:=I+J;
I:=J-I;
END LOOP;
END;
OUTPUT:
Enter value for l: 10
old 4: L NUMBER(2):=&L;
new 4: L NUMBER(2):=10;
FIBONACII SERIES UP TO 10TH LIMIT IS:
0
1
1
2
3
5
8
13
21
34
PL/SQL procedure successfully completed
Algorithm for PLSQL Program to Generate the Fibonacci Series:
Step 1: Declare the variables I, J, and L with NUMBER data type.
Step 2: Initialize the value of I with 1, J with 0 and L with the input value.
Step 3: Display the message "FIBONACII SERIES UP TO 'L' TH LIMIT IS: ".
Step 4: Start a loop for K, where K ranges from 1 to L.
Step 5: Display the value of J.
Step 6: Calculate the new value of J as the sum of I and J.
Step 7: Calculate the new value of I as the difference of J and I.
Step 8: End the loop.
Step 9: End the program.