#include <stdio.h>
int main(void) {
double num = 570.15;
double root = num / 2;
double eps = 0.01;
int iter = 0;
while( root - num / root > eps ){
iter++;
root = 0.5 * (root + num / root);
printf("Iteration: %d : root = %f\n", iter
, root
); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7Cglkb3VibGUgbnVtID0gNTcwLjE1OwoJZG91YmxlIHJvb3QgPSBudW0gLyAyOwoJZG91YmxlIGVwcyA9IDAuMDE7CglpbnQgaXRlciA9IDA7Cgl3aGlsZSggcm9vdCAtIG51bSAvIHJvb3QgPiBlcHMgKXsKCQlpdGVyKys7CgkJcm9vdCA9IDAuNSAqIChyb290ICsgbnVtIC8gcm9vdCk7CgkJcHJpbnRmKCJJdGVyYXRpb246ICVkIDogcm9vdCA9ICVmXG4iLCBpdGVyLCByb290KTsKCX0KCXByaW50Zigicm9vdCA9ICVmIiwgcm9vdCk7CglyZXR1cm4gMDsKfQo=