Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. setlocale(LC_ALL, "rus");
  9. float a, b, e,x,y,xp,yp;
  10. cout << "a=";
  11. cin >> a;
  12. cout << "b=";
  13. cin >> b;
  14. cout << "e=";
  15. cin >> e;
  16. xp = a; x = xp;
  17. yp = b; y = yp;
  18. while (fabs(x - y) < e)
  19. {
  20.  
  21. cout <<"x="<< x<<endl;
  22. x = xp + yp;
  23. //cout << "xnew= " << x;
  24. y = sqrt(x*yp);
  25. //cout << " y=" << y<<endl;
  26. xp = x;
  27. yp = y;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement