fork download
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. struct Coordinate{
  5. int x;
  6. int y;
  7. };
  8.  
  9. int main(void)
  10. { double a,b,c,d,e,f,Shortest_distance,m,n,g,h,i;
  11. scanf("%d %d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
  12. struct Coordinate A={a,b};
  13. struct Coordinate B={c,d};
  14. struct Coordinate C={e,f};
  15. m=(double)(B.y-C.y)/(B.x-C.x);
  16. ///n=(double)B.y-m*B.x;
  17. ///g=m*A.x-A.y+n;
  18. ///h=fabs(g);
  19. ///i=sqrt(m*m+1.0);
  20. ///Shortest_distance=h/i;
  21. printf("%lf",m);
  22. return 0;
  23. }
Success #stdin #stdout 0s 5280KB
stdin
2
6
1
7
6
9
stdout
-nan