fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. struct tri {
  5. double x;
  6. double y;
  7. double z;
  8. };
  9.  
  10. int main(void) {
  11.  
  12. struct tri t = {5,5,5};
  13.  
  14. printf("%lf\n%lf\n%lf\n",t.x,t.y,t.z);
  15.  
  16. double p = ( t.x+t.y+t.z )/2.0;
  17. double s = sqrt(p*(p-t.x)*(p-t.y)*(p-t.z));
  18.  
  19. printf("面積:%lf",s);
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
5.000000
5.000000
5.000000
面積:10.825318