Ad
The factorial of a positive number is the product of all the integer numbers from 1 up to that particular number say n.
Let us take an example, the factorial of a number 5 is the product of all numbers from 1 to the number itself as 1*2*3*4*5 = 120.
Ad
Factorial can be defined for Positive Intergers only.
There is no factorial of Negative numbers.
The factorial of 0 is 1.
C++ Program of Factorial Using Recursion
#include<iostream>
using namespace std;
int factorial(int n);
int main()
{
    int n;
    cout << "Enter a positive integer: ";
    cin >> n;
    cout << "Factorial of " << n << " = " << factorial(n);
    return 0;
}
int factorial(int n)
{
    if(n > 1)
        return n * factorial(n - 1);
    else
        return 1;
}
Code language: PHP (php)Output Of Above Program
Enter an positive integer: 6 Factorial of 6 = 720
