fork download
  1.  
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5. int main(void)
  6. {
  7. double eps = 0.001;
  8. double t = 2.0;
  9. double delta = t;
  10. int i = 2;
  11.  
  12. while (delta > eps) {
  13. double tt = t;
  14.  
  15. t = pow(1.0 + (1.0 / i), i);
  16.  
  17. delta = t - tt;
  18. i++;
  19. }
  20.  
  21. printf("%d: %f\n", i- 1, t);
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 4880KB
stdin
Standard input is empty
stdout
37: 2.682435