The C program given here is a solution for Finding the Factorial of a given number using Recursion. A straight definition of recursion is, a function calls itself. Each recursive call will be stored in Stack.

A stack is a linear data structure, which is used to store the data in LIFO (Last in First out) approach.

#include<stdio.h>

int fact(int);
int main()
{
    int x,n;
    printf(" Enter the Number to Find Factorial :");
    scanf("%d",&n);

    x=fact(n);
    printf(" Factorial of %d is %d",n,x);

    return 0;
}
int fact(int n)
{
    if(n==0)
        return(1);
    return(n*fact(n-1));
}

OUTPUT:

Enter the Number to Find Factorial :5
Factorial of 5 is 120

 Check the other programs for factorial

C Program to Find Factorial of a Number using Functions

C Program to Find Factorial of a Number using While Loop

C Program for Finding Factorial of a Number

Compute Factorial of Large Numbers using C

Flowchart to Find Factorial of a Number