#include<stdio.h> int main(){ float x; scanf("%f",&x); float b,a=1.0; while(fabs(b-a)>=1.0e-5){ b=(a+x/a)/2.0; a=b; } printf("%.3f",b); return 0; }
Double click to view unformatted code.