Skip to content · ⁨الانتقال إلى المحتوى⁩

Factorial (mind the size) · ⁨المضروب (انتبه للحجم)⁩

English

Factorial (mind the size)

n! is 1 × 2 × … × n, and 0! is 1. It grows fast — 20! is over two billion billion — so the method returns a long, not an int, or the answer would overflow. Multiply from 2 up to n.

العربية

المضروب (انتبه للحجم)

n! هو 1 × 2 × … × n، و0! هو 1. ينمو بسرعة — 20! يتجاوز تريليون تريليون — لذا تُرجع الطريقة long بدلاً من int، وإلا سيحدث طفح في الإجابة. اضرب من 2 حتى n.

Log in or create account · ⁨تسجيل الدخول أو إنشاء حساب⁩

IGCSE, A-Level & AP