fork(8) download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. int i=0;
  7. double x, E;
  8. cin >> x >> E;
  9. double sh=x, a=x;
  10. while((a*=(x*x/(2*i+2)/(2*i+3)))>E) {
  11. sh+=a;
  12. i++;
  13. }
  14. cout << sh << ' ' << sinh(x);
  15. return 0;
  16. }
Success #stdin #stdout 0s 3460KB
stdin
0.52 0.01
stdout
0.543435 0.543754