free2000000 بتاريخ: 6 مارس 2010 تقديم بلاغ مشاركة بتاريخ: 6 مارس 2010 (معدل) 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 مارس 2010 بواسطة free2000000 اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Om MAriam بتاريخ: 7 مارس 2010 تقديم بلاغ مشاركة بتاريخ: 7 مارس 2010 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; اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
free2000000 بتاريخ: 8 مارس 2010 كاتب الموضوع تقديم بلاغ مشاركة بتاريخ: 8 مارس 2010 thank youit was nice to help me in this اقتباس رابط هذا التعليق شارك المزيد من خيارات المشاركة
Recommended Posts
انضم إلى المناقشة
يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.