#include<stdio.h>
#include<conio.h>
#include<math.h>
#define ESP 0.0001
#define F(x) (x)*(exp(x)) = 1
#define X(x) (exp(-x))
#define G(x) -(exp(x))
void main()
{
float x1,x2,x;
int i=1;
clrscr();
do
{
printf("\nEnter the value of x: ");
scanf("%f",&x);
}while(fabs(G(x)) > 1);
x1=X(x);
printf("\n x = %f",x1);
printf("\n\n");
do
{
x2=X(x1);
if(fabs(x1-x2)<ESP)
{
printf("\n\nREAL ROOT = %.3f",x1);
i=0;
}
else
{
x1=x2;
}
if(i==1)
{
printf("\n x = %f",x1);
printf("\n\n");
}
}while(i!=0);
getch();
}
/*
____________________________
OUT PUT
____________________________
Enter the value of x: 90
x = 1.275963
x = 1.645290
x = 1.462788
x = 1.553900
x = 1.508448
x = 1.531154
x = 1.519816
x = 1.525479
x = 1.522651
x = 1.524063
x = 1.523358
x = 1.523710
x = 1.523534
REAL ROOT = 1.524
*/