here is the c program for arriving at a solution using bisection method.
The ouput is going infinte..pls help ....i think it has more of syntax errors than logical errors...
The ouput is going infinte..pls help ....i think it has more of syntax errors than logical errors...
Rich (BB code):
#include<stdio.h>
#include<math.h>
main()
{float a,b,c,x1,x2,x,series;
double d;
printf("enter a,b,c and x1(pos) & x2(neg)");
scanf("%f%f%f%f%f",&a,&b,&c,&x1,&x2);
x=0;
d=1;
while(d>0.0001)
{
x=(x1+x2)/2;
series=a*x*x+b*x+c;
d=fabs(series);
if(x*x1 < 0)
x2=x;
else
x1=x;
}
printf("ans=%f",x);
return 0;
}
Last edited: