SQL> DECLARE
2 FACT NUMBER:= 1;
3 I NUMBER:=&I;
4 BEGIN
5 WHILE(I>0) LOOP
6 FACT:= FACT*I;
7 I:=I-1;
8 END LOOP;
9 DBMS_OUTPUT.PUT_LINE(FACT);
10 END;
11 /
Enter value for i: 5
120
PL/SQL procedure successfully completed.
0 Comments