0
/ 50
Write a function in C++ called 'factorial' that will take a positive integer as input and returns its factorial. In math, a factorial is...
Write a function in C++ called 'factorial' that will take a positive integer as input and returns its factorial. In math, a factorial is the product of all positive integers less than or equal to a given positive integer. If the integer is zero, the factorial is 1.
For example, calling factorial(3);
should calculate 3x2x1 and return 6.
Examples:
factorial(0) -> 1
factorial(3) -> 6
Your feedback will appear here when you check your answer.