fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. #define PI 3.14
  4. struct Elipse{
  5. int a;
  6. int b;
  7. }Data={5,2};
  8. struct coordinate{
  9. int x;
  10. int y;
  11. int z;
  12. };
  13.  
  14. int main(void) {
  15. printf("area:%lf\n",PI*Data.a*Data.b);
  16.  
  17. struct coordinate a={1,5,2};
  18. struct coordinate b={5,3,1};
  19. struct coordinate c={2,8,4};
  20. double length_ab;
  21. double length_co;
  22. length_ab=sqrt((b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y)+(b.z-a.z)*(b.z-a.z));
  23. length_co=sqrt(c.x*c.x+c.y*c.y+c.z*c.z);
  24. if(length_ab>length_co){
  25. printf("length:%lf\n",length_ab);
  26. }
  27. else {printf("length:%lf\n",length_co);
  28. }
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
area:31.400000
length:9.165151