#include<stdio.h>
#include<conio.h>
long int factorial(int n);
void main()
{
int n;
clrscr();
printf("\n Enter the number");
scanf("\n %d",&n);
printf("\n Factorial of %d is %ld",n,factorial(n));
getch();
}
long int factorial(int n)
{
if(n<=1)
{
return(01);
}
else
{
n=n*factorial(n-1);
return(n);
}
}
output:-
Enter the number n=5
Factorial of 5 = 120