بتاريخ: 6 مارس 201016 سنة comment_186448 1. Create and store a function that takes a single input number, and returns the factorial of the number.The factorial of a number n is defined as 1 2 3 : : : (n ???? 1) n. If the input number is negative,the function should give an error message, and return a value of ????1. Note that the factorial of zero is1 by definition. You should implement the function in your own way, i.e., do not call a pre-definedfunction in PL/SQL. تم تعديل 6 مارس 201016 سنة بواسطة free2000000 تقديم بلاغ
بتاريخ: 7 مارس 201016 سنة comment_186502 Try this one: CREATE OR REPLACE FUNCTION GET_FACTORIAL_NUMBER(n integer) RETURN integer IS x integer := 1; --i integer := 1; -- counter BEGIN if n < 0 then dbms_output.put_line('Error entered negative Number!'); x := -1; else for i in 1..n loop x := i*x; --dbms_output.put_line(i||'!= '||x); end loop; end if; dbms_output.put_line(n||'!= '||x); RETURN x; END; تقديم بلاغ
بتاريخ: 8 مارس 201016 سنة كاتب الموضوع comment_186672 thank youit was nice to help me in this تقديم بلاغ
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.