C Programming

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.

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.

You may also like

Program by Using External Storage Class
C Programming

C Program by Using External Storage Class

In this article, we are showing you how to write a C Program by using External Storage Class. Before that,