#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int user_power,i=0,cnt=0,flag=0;
int coef[10]={0};
float x1=0,t=0;
float x2=0;
void main()
{
clrscr();
printf("\n\n\t\t\t PROGRAM FOR SUCESSIVE APPROXIMATION");
printf("\n\tINTIAL X1---->");
scanf("%f",&x2);
/*************************************************************************/
printf("\n ******************************************************");
printf("\n ITERATION X1 FX1 ");
printf("\n **********************************************************");
do
{
cnt++;
x1=x2;
x2=(2-(log10(x1)));
printf("\n %d %.3f %.3f ",cnt,x1,x2);
}while((fabs(x2 - x1))>=0.0001);
printf("\n\t THE ROOT OF EQUATION IS %f",x1);
getch();
}
/*******************************OUTPUT**********************************/
PROGRAM FOR SUCESSIVE APPROXIMATION
INTIAL X1---->10
********************************
ITERATION X1 FX1
********************************
1 10.000 1.000
2 1.000 2.000
3 2.000 1.699
4 1.699 1.770
5 1.770 1.752
6 1.752 1.756
7 1.756 1.755
8 1.755 1.756
9 1.756 1.756
********************************
THE ROOT OF EQUATION IS 1.755633