Header Ad

C Program to Print Factorial using Recursion

In this tutorial, we are going to make a C Program to Print factorial using Recursion with step by step full complete explanation.

C Program to Print factorial using Recursion


Program Code to print factorial using recursion.

#include<stdio.h>
#include<conio.h>
int Factorial(int input);
void main()
{
       int n;

printf("Enter first number: ");
scanf("%d", &n);


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

getch();
}
int Factorial(int input)
{
       if(input==0)
           return 1;
       else
            return input*Factorial(input-1);
       
}


Output

C Program to Print Factorial using Recursion

Post a Comment

0 Comments