Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Factorial A factorial of a n = n^* (n-1)^* (n-2)^*... * 3^* 2^* 1. For examp

ID: 3680492 • Letter: C

Question

C++

Factorial A factorial of a n = n^* (n-1)^* (n-2)^*... * 3^* 2^* 1. For example, 5! (five factorial) is 5*4*3*2*1 = 120. Individually write (using pencil/pen and paper) a recursive function factorial that will take an integer value n as an argument, and will return n!. Then compare your function to your partner's, together (i) come up with a function implementation you both agree on, and (ii) write it as a C++ function on the computer. Then write a short C++ program that will call your function and display the factorial of 10.

Explanation / Answer

#include using namespace std; int factorial(int n); int main() { int n; cout > n; cout