Advertisement
kirya_shkolnik

Давид 5 задача

Mar 24th, 2022
812
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. double Root(double E, double x0){
  2.     double xp, xn = x0;
  3.     do{
  4.         xp = xn;
  5.         xn = cos(xp);
  6.     } while (fabs(xn-xp) >= E);
  7.     return xn;
  8. }
  9.  
  10. int main(){
  11.     double eps = 1e-6, x0 = 1.0;
  12.     double r = Root(eps, x0);
  13.     cout<<r<<endl;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement