18 lines
649 B
Plaintext
18 lines
649 B
Plaintext
;Definitions:
|
|
:* The factorial of '''0''' (zero) is [[wp:Factorial#Definition|defined]] as being 1 (unity).
|
|
:* The '''Factorial Function''' of a positive integer, <big> ''n'', </big> is defined as the product of the sequence:
|
|
<big><big> ''n'', ''n''-1, ''n''-2, ... 1 </big></big>
|
|
|
|
|
|
;Task:
|
|
Write a function to return the factorial of a number.
|
|
|
|
Solutions can be iterative or recursive.
|
|
|
|
Support for trapping negative <big> ''n'' </big> errors is optional.
|
|
|
|
|
|
;Related task:
|
|
* [[Primorial numbers]]
|
|
<br><br>
|