Home » C++ » Solved Programs » Program of Recursion
C++ Program of Recursion
#include<iostream>
using namespace std;
int factorial(int no)
{
int number = 1;
if(no == 1)
return 1;
number = no * factorial(no -1);
return number;
}
int main()
{
int no;
cout<<"\n Enter any number : ";
cin>>no;
cout<<"\n Factorial is : "<< factorial(no);
return 0;
}