RosettaCodeData/Task/Factorial/00DESCRIPTION

18 lines
649 B
Plaintext

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