Loading...
Select Version
The FACTORIAL function returns an integer that is the factorial of argument-1.
The type of this function is integer.
Format
FUNCTION FACTORIAL (argument-1)
Argument
argument-1 must be an integer greater than or equal to zero and less than or equal to 29.
Returned values
If the value of argument-1 is zero, the value 1 is returned.
If the value of argument-1 is positive, its factorial is returned.
The error default value is
-2.
See also: LOG, LOG10, SQRT
Example 9-15
...
DATA DIVISION.
WORKING-STORAGE SECTION.
01 RES PIC 9(8).
PROCEDURE DIVISION.
P1 SECTION.
MAIN.
COMPUTE RES = FUNCTION FACTORIAL (07).
DISPLAY RES UPON T.
STOP RUN.
Result: 00005040