Skip to content

Factorial

Factorial

The factorial n! is the product 1 * 2 * 3 * ... * n. By definition 0! is 1.

Start a result at 1, then multiply it by every integer from 2 up to n in a loop. (The tests keep n at most 10, so the answer fits in an int.)

Log in or create account

IGCSE & A-Level