Programming

Calculate the Factorial by Using Recursion

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

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));
}

Tuts

About Author

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