![]() |
#2
tankiy2010-04-28 13:51
|
看一下这个程序
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
long double a,b=1,c;
cin>>a;
c=a;
for(;fabs(c-b)>1e-20;)
{
c=b;
b=0.5*(b+a/b);
}
cout<<b<<endl;
printf("%.16lf\n",b);
return 0;
}