C Program to Calculate the Factorial by Using Recursion

Calculate the Factorial by Using Recursion

This C Program will help you to calculate the Factorial by Using Recursion Function of C Programming.

If you don’t know much about C Programing then check our C Programming tutorial.

More examples,

C++ Program for Factorial using For, While & Do While
C Program to Calculate the Factorial using Function.
C Program to Calculate the Factorial using Recursion.

Source Code

#include<stdio.h>
#include<conio.h>
void main()
{
 int n; 
 int factorial(int);
 printf("Enter a number:");
 scanf("The factorial of %d is %d", n,factorial(n));
 getch();
}
int factorial(int n)
{
 if(n<1)
 return(1);
 else 
 return(n*factorial(n-1));
}

TutsMaster.org

Tutsmaster.org provides tutorials related to tech and programmings. We are also setting up a community for the users and students.