#include<stdio.h>
int main()
{
int factorial(int x);
int a,Ans;
printf("\n Enter a number of which factorial you want to calculate:");
scanf("%d",&a);
Ans=factorial(a);
printf("\n The factorial of %d is=%d",a,Ans);
return 0;
}
int factorial(int x)
{
int f;
if(x<=1)
{
return 1;
}
f= x * factorial(x-1);
return (f);
}
int main()
{
int factorial(int x);
int a,Ans;
printf("\n Enter a number of which factorial you want to calculate:");
scanf("%d",&a);
Ans=factorial(a);
printf("\n The factorial of %d is=%d",a,Ans);
return 0;
}
int factorial(int x)
{
int f;
if(x<=1)
{
return 1;
}
f= x * factorial(x-1);
return (f);
}