
Implement a function that returns the factorial of n, the product of every integer from 1 to n, with the factorial of 0 defined as 1.
factorial(5)Expected result
120For your own tracking. Tests grade your code.
factorial(0)Expected result
1factorial(-3)Expected result
-1Expected files
factorial.cAllowed functions
None. Write every helper yourself.

v0.40: Create exercises. Challenge the community.
Meet Studio →Implement a function that returns the factorial of n, the product of every integer from 1 to n, with the factorial of 0 defined as 1.
factorial(5)Expected result
120For your own tracking. Tests grade your code.
factorial(0)Expected result
1factorial(-3)Expected result
-1Expected files
factorial.cAllowed functions
None. Write every helper yourself.

Run the tests to grade your code
Build your code, then check each test here. Open a result to inspect its output.