fork download
  1. #include <stdio.h>
  2.  
  3. int factorial(int n){
  4. if(n==1) return 1;
  5. return n*factorial(n-1);
  6. }
  7.  
  8. int main() {
  9. int n;
  10. printf("Enter the value of n ");
  11. scanf("%d",&n);
  12. int fact=factorial(n);
  13. printf("%d",fact);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0s 5316KB
stdin
6
stdout
Enter the value of n  720