SQL Program For Factorial of a number

PROGRAM:PROGRAM:

`Declare`

`num number:= #`

fact number:= 1;

temp number;

begin

` `

`temp := num;`

while (num > 0)

` loop`

` `

`fact := fact * num;`

num := num - 1;

end loop;

Dbms_Output.Put_line('factorial of ' || num ||' is ' || fact);

end;

**OUTPUT:**

4

Factorial of 4 is 24

## No comments:

## Post a Comment