fork download
  1. #include<stdio.h>
  2. int factorial(int x)
  3. {
  4.  
  5. if(x==0)
  6. {
  7. return 1;
  8. }
  9. return x*factorial(x-1);
  10.  
  11.  
  12. }
  13. int main()
  14. {
  15. int a;
  16. printf("enter number:");
  17. scanf("%d",&a);
  18. int result=factorial(a);
  19. printf("the factorial of %d is:%d",a,result);
  20. }
  21.  
Success #stdin #stdout 0.01s 5248KB
stdin
Standard input is empty
stdout
enter number:the factorial of 32765 is:0