fork(10) download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. long long factorial(long long k) {
  5. long long res = 1;
  6. while (k > 0) {
  7. res *= k--;
  8. }
  9. return res;
  10. }
  11.  
  12. int main(void) {
  13. for (int i = 1 ; i != 10 ; i++) {
  14. printf("%lld %f\n", factorial(i), tgamma(i+1));
  15. }
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0s 4300KB
stdin
Standard input is empty
stdout
1 1.000000
2 2.000000
6 6.000000
24 24.000000
120 120.000000
720 720.000000
5040 5040.000000
40320 40320.000000
362880 362880.000000