Answer to Question #196181 in C++ for Alexius

Question #196181

1.write a program to solve 8! Using recursion technique

2.using RAM diagrams show how parameters are passed in your code



1
Expert's answer
2021-05-20T20:21:20-0400
#include<iostream>
#include<bits/stdc++.h>
using namespace std;


int fact(int n)
{
	if(n == 1)
	{
		return 1;
	}
	
	return n*fact(n-1);
}


int main()
{
	int n =8;
	cout<<"Value of 8! is : "<<fact(n);
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog