#include <stdio.h>
#include <math.h>

int main(void)
{
double a,x1=1.0,x2;
printf("please input a number:\n");
scanf("%lf",&a);
x2=x1;
x1=0.5*(x1+a/x1);
for(;fabs(x1-x2)>=1e-5;)
{
x2=x1;
x1=0.5*(x1+a/x1);
}
printf("a^1/2=%.10lf",x1);
}


相关文章:

  • 2021-08-27
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-22
  • 2022-12-23
  • 2021-10-10
  • 2022-12-23
相关资源
相似解决方案