#C12774. Factorial Calculation

    ID: 42238 Type: Default 1000ms 256MiB

Factorial Calculation

Factorial Calculation

Given an integer ( n ), calculate its factorial ( n! ). The factorial is defined as ( n! = 1 \times 2 \times \ldots \times n ) for ( n \geq 1 ) and ( 0! = 1 ). If the given integer is negative, output the error message: Error: Factorial is not defined for negative numbers.

inputFormat

The input consists of a single integer ( n ) read from standard input.

outputFormat

If ( n \geq 0 ), output the factorial of ( n ). Otherwise, if ( n < 0 ), output exactly: Error: Factorial is not defined for negative numbers.## sample

5
120