#include<stdio.h>

#include<conio.h>

#include<math.h>

float f (double x);

void main()

{

clrscr();

float xl,xu,xrold,xrnew;

int c=0;

xl=0.5;

xu=1.0;

xrold=(xl+xu)/2;

float EA;

do

{

c++;

if(f(xl)*f(xrold)<0)

xu=xrold;

if(f(xl)*f(xrold)>0)

xl=xrold;

xrnew=(xl+xu)/2;

EA=(xrnew-xrold)/xrnew;

if(EA<0)

EA=-EA;

xrold=xrnew;

}while(EA>0.1);

printf(“%f, %f,No of transitions %d”,xrold,EA,c);

getch();

}

float f(double x)

{

return -26+85*x-91*pow(x,2)+44*pow(x,3)-8*pow(x,4)+pow(x,5);

}

This question is solved by using the **Bisection Method**. In this question we have **lower point** and **upper point**. So **xl** is representing the **lower limit** and **xu** is representing **upper limit.** When we put **xl** in the function then result will be negative and when we put **xu** in function the result will be positive.

This can be checked by ensuring that **f(xl)(xu)<0.**

An estimate of the root **xr** is determined by **xr=(xl+xu)/2**.

In this program we use **xrold** and **xrnew**. **xrold** will be replaced by **xrnew** when a new point replaced the **xl** or**xu.** **xr** representing the **mid point** of **xl** and **xu.** If the **xr<0** then the value of **xl** is replaced by **xr** and if the **xr>0**then the value of **xu** will be replaced by **xr.**

The **f** function is returning the result of **-26+85x-91×2+44×3-8×4+x5.**

The **Rules** for changing the Limits according to **Numerical computing** are:

Following evaluations to determine in which sub interval the root lie.

1) If **f(xl)f(xr)<0,** the root lies in the lower sub interval. Therefore ,set **xu=xr.**

2) If f**(xl)f(xr)>0,** the root lies in the upper sub interval. Therefore ,set **xl=xr**

3) If **f(xl)f(xr)=0**, the root equals **xr**; terminate the computation.