View Source Multitool.Numbers.Factorial (multitool v0.3.4)

Provides operations for working with the factorials of numbers

The factorial of a number is the product of all numbers up to and including the number itself, starting at one

Link to this section Summary

Functions

Calculates the factorial of the given positive integer

Link to this section Functions

Calculates the factorial of the given positive integer

If a non-positive integer is provided, zero is returned

parameters

Parameters

n: Positive integer to calculate the factorial of

examples

Examples

iex> factorial(3)
6
iex> factorial(-5)
0
iex> factorial(10)
3628800