1.write a program to solve 8! Using recursion technique
2.using RAM diagrams show how parameters are passed in your code
#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);
}
Comments
Leave a comment