SHARE
TWEET

Untitled

a guest Nov 20th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. double det(int a1,int a2,int a3,int b1,int b2,int b3,int c1,int c2,int c3)
  5. {
  6.     double M;
  7.     M= a1*(b2*c3-c2*b3)-b1*(a2*c3-c2*a3)+c1*(a2*b3-b2*a3);
  8. return M;
  9. }
  10. int main()
  11. {
  12.     int a1,a2,a3,b1,b2,b3,c1,c2,c3,d1,d2,d3;
  13.     double D,Dx,Dy,Dz,x,y,z;
  14.  
  15.     printf("PleaseInput a1,..,b1,..,c1,..\n");
  16.     scanf("%d %d %d %d %d %d %d %d %d %d %d %d",&a1,&b1,&c1,&d1,&a2,&b2,&c2,&d2,&a3,&b3,&c3,&d3);
  17.  
  18.     D=det(a1,a2,a3,b1,b2,b3,c1,c2,c3);
  19.     Dx=det(d1,d2,d3,b1,b2,b3,c1,c2,c3);
  20.     Dy=det(a1,a2,a3,d1,d2,d3,c1,c2,c3);
  21.     Dz=det(a1,a2,a3,b1,b2,b3,d1,d2,d3);
  22.  
  23.     x=Dx/D;
  24.     y=Dy/D;
  25.     z=Dz/D;
  26.  
  27.     printf("X=%f\n",x);
  28.     printf("Y=%f\n",y);
  29.     printf("Z=%f\n",z);
  30.  
  31. return 0;
  32. }
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. OK, I Understand
 
Top