#include<stdio.h>
#include<conio.h>
#include<math.h>
#define epsil 0.00001
int p,c[10];
void appro();
voidfalse(float,float,float,float);
void main()
{
clrscr();
appro();
getch();
}
voidfalse(float x1,float x2,float fx1,float fx2)
{
float x3,fx3,temp;
int n=1;
printf("******************************************************************\n");
printf("\nIt x1 fx1 x2 fx2 x3 fx3\n");
printf("******************************************************************\n");
do
{
temp=x3;
x3=(((x1*fx2)-(x2*fx1))/(fx2-fx1));
fx3=(exp(x3)-(3*(x3)));
x1=x2;
fx1=fx2;
x2=x3;
fx2=fx3;
printf("%d %.4f %.4f %.4f %.4f %.4f %.4f\n",n,x1,fx1,x2,fx2,x3,fx3);
n=n+1;
}while((fabs(temp-x3)>=epsil)&&(fx3!=0));
printf("\n\t\t********************\n");
printf("\n\t\tThe root is %.4f\n",x3);
printf("\t\t********************\n");
}
void appro()
{
float x1,x2,x3,fx1,fx2,fx3;
printf("\nPlease Enter first approximation: ");
scanf("%f",&x1);
printf("\nPlease Enter second approximation: ");
scanf("%f",&x2);
fx1=(exp(x1)-(3*(x1)));
fx2=(exp(x2)-(3*(x2)));
false(x1,x2,fx1,fx2);
}