factorial
Calculate the factorial of any non-negative integer. Computes the product of all positive integers from 1 to the given number for mathematical operations and calculations.
Instructions
Calculate the factorial of a non-negative integer.
The factorial of n (written as n!) is the product of all positive integers
less than or equal to n. For example: 5! = 5 × 4 × 3 × 2 × 1 = 120
Args:
n: A non-negative integer
Returns:
The factorial of n
Raises:
ValueError: If n is negative
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | Yes |
Input Schema (JSON Schema)
{
"properties": {
"n": {
"title": "N",
"type": "integer"
}
},
"required": [
"n"
],
"type": "object"
}