Recursion
Given int 8;
(1) Write a program to solve 8! Using recursion technique.
(2) Using RAM diagrams show how the parameters are passed in your code.
#include <iostream> using namespace std; int factorial(int n) { return n ? n * factorial(n-1) : 1; } int main() { cout << factorial(8); return 0; }
Need a fast expert's response?
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!