fork(2) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. double x, e;
  7. cin>>x>>e;
  8. double result=1;
  9. double component=1;
  10. for (int i=1; abs(component)>=e; i++)
  11. {
  12. component*=(x/i);
  13. result+=component;
  14. }
  15. cout<<result<<endl;
  16. return 0;
  17. }
Success #stdin #stdout 0s 3464KB
stdin
17 0.072
stdout
2.4155e+07