Factorial Calculator
Enter a non‑negative integer to compute its factorial n!, the product of all positive integers up to n.
Examples
- 5! ⇒ 120
- 3! ⇒ 6
- 0! ⇒ 1
FAQ
What is factorial?
Factorial of n is the product of all positive integers up to n.
Can n be negative?
No, factorial is defined for non‑negative integers only.
What is 0!?
By convention 0! equals 1.
Is there a factorial for decimals?
Not directly, but the gamma function provides a continuous extension.
Why use Math.floor?
It ensures n is treated as an integer before calculation.
Additional Information
- The factorial of n is written as n! and equals n × (n−1) × … × 1.
- 0! is defined as 1 so formulas remain consistent at the lower bound.
- Factorials appear in permutations, combinations, and many probability formulas.
- Growth is super‑exponential; approximations like Stirling's formula estimate large values.
- The gamma function extends factorial concepts to non‑integer values.