Recursive Functions in C++ with Factorial Program

This video tutorial explains the recursion in c++.
You are gonna learn what is a recursive function, how to define a recursive function, how to use a recursive function with an example by writing a function to find the factorial of a number recursively.

source code for this tutorial

#include <iostream>

using namespace std;

int factorial(int n);

int main()
    cout << factorial(5) << endl;
    return 0;

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


Back To Top