pl/sql program to finding factorial of given number.
Procedure:
declare
i number(4):=1;
n number(4):=&n;
f number(4):=1;
begin
for i in 1..n
loop
f:=f*i;
end loop;
Dbms_output.put_line('the factorial of '||n||' is:'||f);
end;
/
Output:
SQL> @e:\plsql\fact.sql
Enter value for n: 5
old 3: n number(4):=&n;
new 3: n number(4):=5;
the factorial of 5 is:120
PL/SQL procedure successfully completed.
Conclusion:
a pl/sql program is successfully executed for finding factorial of a given number
Procedure:
declare
i number(4):=1;
n number(4):=&n;
f number(4):=1;
begin
for i in 1..n
loop
f:=f*i;
end loop;
Dbms_output.put_line('the factorial of '||n||' is:'||f);
end;
/
Output:
SQL> @e:\plsql\fact.sql
Enter value for n: 5
old 3: n number(4):=&n;
new 3: n number(4):=5;
the factorial of 5 is:120
PL/SQL procedure successfully completed.
Conclusion:
a pl/sql program is successfully executed for finding factorial of a given number
getting fucking ass error bc!!!
ReplyDeletePlease share PL sQL program for find entered factorial number
ReplyDelete