Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- double sqrt_a(double a, double eps) {
- int xk[100];
- xk[1] = a;
- int i = 2;
- for (; abs(xk[i] - xk[i - 1]) < eps; i++)
- {
- xk[i] = 1 / 2 * (xk[i - 1] + (a / xk[i - 1]));
- }
- return abs(xk[i] - xk[i - 1]);
- }
Advertisement
Add Comment
Please, Sign In to add comment