#include<stdio.h>
#include<conio.h>
#include<math.h>
#define ESP 0.0001
#define X1(x2,x3) ((17 - 20*(x2) + 2*(x3))/20)
#define X2(x1,x3) ((-18 - 3*(x1) + (x3))/20)
#define X3(x1,x2) ((25 - 2*(x1) + 3*(x2))/20)
void main()
{
double x1=0,x2=0,x3=0,y1,y2,y3;
int i=0;
clrscr();
printf("\n__________________________________________\n");
printf("\n x1\t\t x2\t\t x3\n");
printf("\n__________________________________________\n");
printf("\n%f\t%f\t%f",x1,x2,x3);
do
{
y1=X1(x2,x3);
y2=X2(x1,x3);
y3=X3(x1,x2);
if(fabs(y1-x1)<ESP && fabs(y2-x2)<ESP && fabs(y3-x3)<ESP )
{
printf("\n__________________________________________\n");
printf("\n\nx1 = %.3lf",y1);
printf("\n\nx2 = %.3lf",y2);
printf("\n\nx3 = %.3lf",y3);
i = 1;
}
else
{
x1 = y1;
x2 = y2;
x3 = y3;
printf("\n%f\t%f\t%f",x1,x2,x3);
}
}while(i != 1);
getch();
}
/*
OUT PUT
___________
__________________________________________
x1 x2 x3
__________________________________________
0.000000 0.000000 0.000000
0.850000 -0.900000 1.250000
1.875000 -0.965000 1.030000
1.918000 -1.129750 0.917750
2.071525 -1.141812 0.888737
2.080686 -1.166292 0.871576
2.103449 -1.168524 0.866988
2.105223 -1.172168 0.864376
2.108606 -1.172565 0.863653
2.108930 -1.173108 0.863255
2.109434 -1.173177 0.863141
__________________________________________
x1 = 2.109
x2 = -1.173
x3 = 0.863
*/