• API
• FAQ
• Tools
• Archive
SHARE
TWEET # m a guest Feb 26th, 2020 80 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. #include<stdio.h>
2. #include<conio.h>
3. #include<math.h>
4. #define eps 0.0001
5. #define x1(x2,x3)((5-x2-x3)/2)
6. #define x2(x1,x3)((15-3*(x1)-2*(x3))/5)
7. #define x3(x1,x2)((8-2*(x1)-x2)/4)
8. int main()
9. {
10.     double x1=0,x2=0,x3=0,y1,y2,y3;
11.     int i=0;
12.     printf("\n x1\t\t x2\t\t x3\n");
13.     printf("\n%f\t%f\t%f\t",x1,x2,x3);
14.     do
15.     {
16.         y1=x1(x2,x3);
17.         y2=x2(y1,x3);
18.         y3=x3(y1,y2);
19.         if(fabs(y1-x1)<eps&&fabs(y2-x2)<eps&&fabs(y3-x3)<eps)
20.         {
21.             printf("\n\nx1=%.31f",y1);
22.             printf("\n\nx2=%.31f",y2);
23.             printf("\n\nx3=%.31f",y3);
24.             i=1;
25.
26.         }
27.         else
28.         {
29.             x1=y1;
30.             x2=y2;
31.             x3=y3;
32.             printf("\n%f\t%f\t%f",x1,x2,x3);
33.
34.         }
35.     }while(i!=1);
36.     return 0;
37.     getch();
38.
39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top