logo CodeStepByStep logo

Factorial

Write a method named Factorial that accepts an integer n as a parameter and returns the Factorial of n, or n!. A Factorial of an integer is defined as the product of all integers from 1 through that integer inclusive. For example, the call of Factorial(4) should return 1 * 2 * 3 * 4, or 24. The Factorial of 0 and 1 are defined to be 1. You may assume that the value passed is non-negative and that its Factorial can fit in the range of type int.

Method: Write a C# method as described, not a complete program or class.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.