Easy · Math

Factorial number

Given an integer n ≤ 20, return n!, the product of the integers 1 through n (with 0! = 1), or 0 when n is negative.

Examples

Example 1

n = 5

Output: 5! = 120

Example 2

n = 0

Output: 0! = 1

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Math problems