Question: In C++ Please #include using namespace std; int factorial(int value) { if (value > 0) return value*factorial(value-1); return 1; } int main() { int num;
In C++ Please


#include
int factorial(int value) { if (value > 0) return value*factorial(value-1); return 1; }
int main() { int num; cout > num; cout 5.12 Factorial of an inputted integer Write a recursive function called factorial() to return the factorial of an integer that was inputted from keyboard. The printing of output will be done in the main function. The factorial of n is n! which is given by n(n-1)(n-2)..2*1 Hence the factorial of 5 is 5X4X3X2X1 120. Similarly, the factorial of 4 is 4X3X2X1 = 24 = Ex. If the input is: 5 the output is: The factorial of 5 is 120 main.cpp Load default template... 1 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
