Monday, 30 June 2014

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

2 comments:

  1. getting fucking ass error bc!!!

    ReplyDelete
  2. Please share PL sQL program for find entered factorial number

    ReplyDelete

Copyright © ORACLE-FORU - SQL, PL/SQL and ORACLE D2K(FORMS AND REPORTS) collections | Powered by Blogger
Design by N.Design Studio | Blogger Theme by NewBloggerThemes.com