fork download
  1. #include <stdio.h>
  2.  
  3.  
  4. int ft_factorial(int n)
  5. {
  6. if(n>0)
  7. {
  8. while(n > 0)
  9. {
  10. return (n * n-1);
  11. n -- ;
  12. }
  13. }
  14.  
  15.  
  16. else if(n == 0)
  17. {
  18. return (1);
  19. }
  20. return 0;
  21. }
  22.  
  23.  
  24. int main(void) {
  25.  
  26. printf("%d",ft_factorial(2));
  27.  
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0s 5292KB
stdin
Standard input is empty
stdout
3