WRITE A PL/SQL PROGRAM FACTORIAL OF GIVEN NUMBER BY USING WHILE LOOP

FACTORIAL OF GIVEN NUMBER BY USING WHILE LOOP

DECLARE
NUM NUMBER(3);
FACT NUMBER(10);
BEGIN
NUM:=#
FACT:=1;
DBMS_OUTPUT.PUT_LINE('ENTER ANY NUMBER FOR ITS FACTORIAL: '||NUM);
WHILE NUM>=1
LOOP
FACT:=FACT*NUM;
NUM:=NUM-1;
END LOOP;
DBMS_OUTPUT.PUT_LINE('FACTORIAL: '||FACT );
END;

Previous
Next Post »