Program 1
// Recursion Implementation
#include<iostream>
#define MAXSIZE 5
using namespace std;
int factorial(int n);
int main()
{
system("cls");
int n,f;
cout<<"\n Enter the number";
cin>>n;
f=factorial(n);
cout<<"\n Factorial is : "<<f;
return 0;
}
int factorial(int n)
{
static int f=1;
if(n==0)
return(f);
f=f*n;
n--;
factorial(n);
}
// Series from 1 to n using recursion
// void display(int n);
// int main()
// {
// int n;
// system("cls");
// cout<<"Enter the limit: ";
// cin>>n;
// display(n);
// return 0;
// }
// void display(int n) // n=10
// {
// static int i=1; // i=2
// if(i>n)
// return;
// cout<<"\n"<<i; // 1 2
// i++; // 3
// display(n);
// }