الانتقال إلى المحتوى
View in the app

A better way to browse. Learn more.

مجموعة مستخدمي أوراكل العربية

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

I Need A Hlpe To Create A Function That Takes A Single Input Number, And Returns The Factorial Of The Number

Featured Replies

بتاريخ:

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 is
1 by definition. You should implement the function in your own way, i.e., do not call a pre-defined
function in PL/SQL.

post-105730-1267908654_thumb.jpg

تم تعديل بواسطة free2000000

بتاريخ:

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;

بتاريخ:
  • كاتب الموضوع

thank you
it was nice to help me in this :rolleyes:

انضم إلى المناقشة

يمكنك المشاركة الآن والتسجيل لاحقاً. إذا كان لديك حساب, سجل دخولك الآن لتقوم بالمشاركة من خلال حسابك.

زائر
أضف رد على هذا الموضوع...

برجاء الإنتباه

بإستخدامك للموقع فأنت تتعهد بالموافقة على هذه البنود: سياسة الخصوصية

Account

Navigation

البحث

إعداد إشعارات المتصفح الفورية

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.