#C14815. Iterative Factorial Calculation
Iterative Factorial Calculation
Iterative Factorial Calculation
Given a single integer \(n\), compute \(n!\) (the factorial of \(n\)) using an iterative approach. Recall that the factorial of a non-negative integer is defined as:
\( n! = \prod_{i=1}^{n} i \) with the convention that \(0! = 1\).
If \(n\) is negative, output the error message Factorial is not defined for negative integers
.
inputFormat
The input consists of a single integer \(n\) read from standard input.
outputFormat
If \(n\) is non-negative, output the factorial of \(n\). Otherwise, output the error message Factorial is not defined for negative integers
.
0
1