Compute n! = 1 × 2 × … × n (with 0! = 1).
Input
A single integer n.
Output
The value of n!. (It gets large — pick a language with big integers, or keep within 64-bit for the given limits.)
Compute n! = 1 × 2 × … × n (with 0! = 1).
A single integer n.
The value of n!. (It gets large — pick a language with big integers, or keep within 64-bit for the given limits.)
Example 1
5
120
1·2·3·4·5 = 120.
Example 2
0
1
0! = 1.
Example 3
10
3628800
10! = 3628800.
Multiply the numbers from 1 up to n.
0! is defined as 1 — the empty product.
Multiply 1 through n; start the running product at 1 so that n = 0 yields 1.
n = int(input())
f = 1
for i in range(2, n + 1):
f *= i
print(f)
Tell us what needs to change, who it affects and any important deadline. We will review the context and reply with useful next questions.