fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. struct side {
  5. double a;
  6. double b;
  7. double c;
  8. };
  9.  
  10. int main(void) {
  11. struct side t;
  12. double s;
  13. double S;
  14.  
  15. t.a = 3;
  16. t.b = 4;
  17. t.c = 5;
  18.  
  19. s = (t.a + t.b + t.c) / 2.0;
  20. S = sqrt(s * (s - t.a) * (s - t.b) * (s - t.c));
  21.  
  22. printf("面積は %lf です", S);
  23.  
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
面積は 6.000000 です