#include<bits/stdc++.h> using namespace std; int main() { double x,a,b; scanf("%lf",&x); a=x; b=(a+x/a)/2; while((a-b)>=0.00001) { a=b; b=(a+x/a)/2; } printf("%.3lf\n",b); return 0; }
Double click to view unformatted code.