牛顿迭代法
#include <stdio.h>
#include <math.h>
int main(){
int a;
scanf("%d", &a);
const double ERR_RANGE = 1.0 / (1 << 20);
double res = a;
while (fabs(res * res - a) > ERR_RANGE){
res = (res + a / res) / 2;
}
printf("sqrt(a) = %.6lf.\n", res);
return 0;
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。