#include<stdio.h>
#include<math.h>
float fu(float x)//defining a function
{
float f;
f = ((x*x*x)+(4*x*x)-10);
return f;
}
int main()
{
float xl,xu,xr,xi;
xr =(xu+xl)/2;
printf("\nenter xl and xu\n");
scanf("%f%f",&xl,&xu);
if(fu(xu)*fu(xl)<0)
{
while(fabs(fu(xr))>0.0001)
{
xr=((xl+xu)/2);
if(fu(xr)*fu(xl)<0)
{
xu = xr;
}
else
{
xl=xr;
}
}
printf("\nroot of the equation is xr =%f\n\n",xr);
}
else
{
printf("\nentered values are not correct\n");
}
}