#include <stdio.h>
int fact(int x);
int main()
{
 int n,fa;
 printf("Enter a number:\n");
 scanf("%d",&n);
 fa=fact(n);
 printf("factorial is %d",fa);
 return 0;
}
int fact(int x)
{
 int f;
 if(x==0)
 {
  return 1;
 }
 else
 {
  f=x*fact(x-1);
  return f;
 }
}
 

0 Comments
Your Comment is Submitted