二分法求零点,为什么运行不到结果?求大神指点,感激万分!!
#include<stdio.h>#include<math.h>
int main()
{
float F(float);
float a,b,c;
printf("please enter the possible area:");
scanf("%f%f",&a,&b);
printf("\n");
c=(a+b)/2;
for(;c>0.000001;)
{
if(F(a)*F(c)<0)
b=c;
else
a=c;
c=(a+b)/2;
}
printf("the approximate zero is %10.5f\n",c);
return 0;
}
float F(float x)
{
float t;
t=x*x-3;
return(t);
}