fork(1) download
  1. #include <stdio.h>
  2. int main(void)
  3. {
  4. int i,n;
  5. long p=1;
  6. printf("Please enter n:");
  7. scanf("%d", &n);
  8. for (i=1; i<=n; i++)
  9. {p=i*p;
  10. printf("%d! = %ld\n", n,p);
  11. }
  12. return 0;
  13. }
Success #stdin #stdout 0s 5304KB
stdin
9
stdout
Please enter n:9! = 1
9! = 2
9! = 6
9! = 24
9! = 120
9! = 720
9! = 5040
9! = 40320
9! = 362880