//13.
#include<stdio.h>
#include<math.h>
int main(void)
{
float a,x1,x2;
printf("请输出一个数\n");
scanf_s("%f", &a);
for (x1=(a/2.0);;)
{
x2 = (x1 + a / x1) / 2;
x1 = x2;
if (fabs(x2 - x1) <= pow(10, -5)) break;
}
printf("a的根号=%f", x2);
return 0;
}
#include<stdio.h>
#include<math.h>
int main(void)
{
float a,x1,x2;
printf("请输出一个数\n");
scanf_s("%f", &a);
for (x1=(a/2.0);;)
{
x2 = (x1 + a / x1) / 2;
x1 = x2;
if (fabs(x2 - x1) <= pow(10, -5)) break;
}
printf("a的根号=%f", x2);
return 0;
}