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

Core interview problems are free with a full runner and lessons; Pro opens the complete library.

More Math problems