fork download
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5. double e;
  6. scanf ("%lf", &e);
  7. double s = 0;
  8. double a=0.5;
  9. int i=1;
  10. while(a>e)
  11. {
  12. i++;
  13. s+=a;
  14. a=1.0/(i*(i+1.0));
  15. }
  16. printf("%0.4lf\n", s);
  17. return 0;
  18. }
Success #stdin #stdout 0s 2252KB
stdin
0.035
stdout
0.8000