Advertisement
Nayeemzaman

equation

Nov 7th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     double X,Y,a1,a2,b1,b2,c1,c2;
  5.     int t,i;
  6.     scanf("%d",&t);
  7.     for(i=0;i<t;i++)
  8.     {
  9.         scanf("%lf %lf %lf %lf %lf %lf",&a1,&b1,&c1,&a2,&b2,&c2);
  10.         if(c1>0 || c1<0)
  11.             {c1=-(c1);}
  12.         if(c2>0 || c2<0)
  13.             {c2=-(c2);}
  14.         X=((b1*c2)-(b2*c1))/((a1*b2)-(a2*b1));
  15.         Y=((c1*a2)-(c2*a1))/((a1*b2)-(a2*b1));
  16.         printf("Case %d:\n",i+1);
  17.         printf("X = %.2lf Y = %.2lf\n",X,Y);
  18.  
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement