牛顿迭代法求解 fabs(x,1/3),怎么运行不了。。。
#include<stdio.h>#include<math.h>
int main()
{
float a,x1,x2,f,f1;
printf("the number that will be calculate is:%f",a);
scanf("%f",&a);
printf("the beginning number is:%f",x1);
scanf("%f",&x1);
do
{
x1=x2;
f=pow(x1,1/3)-a;
f1=(1/3)*pow(x1,(-2/3));
x2=x1-f/f1;
}
while(fabs(x2-x1)>0.0001);
printf("the result is:%f",x1);
return 0;
}