C++ program of Recursion

In this program we will clear the concept of recursion, that how a function calls it self and shows us the real value.

//Code Starts

#include<iostream>

#include<conio.h>

using namespace std;

int rf(int n)

{

if(n==1)

{

return 1;

}

elseĀ 

{

return n*rf(n-1);

Screenshot (3).png

}

int main()

{

int m;

cout<<“Enter value to find factorial : “;

cin>>m;

cout<<rf(m);

getch();

}

//Code ends

OUTPUT:

Screenshot (3).png