fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. struct Triangle {
  5. double a;
  6. double b;
  7. double c;
  8. };
  9.  
  10. int main(void) {
  11. struct Triangle x;
  12. double d, s;
  13.  
  14. scanf("%lf %lf %lf", &x.a, &x.b, &x.c);
  15.  
  16. d = (x.a + x.b + x.c) / 2.0;
  17.  
  18. s = sqrt(d * (d - x.a) * (d - x.b) * (d - x.c));
  19.  
  20. printf("a:%d\n", (int)x.a);
  21. printf("b:%d\n", (int)x.b);
  22. printf("c:%d\n", (int)x.c);
  23. printf("三角形の面積:%f\n", s);
  24.  
  25. return 0;
  26. }
Success #stdin #stdout 0.01s 5316KB
stdin
5 5 5
stdout
a:5
b:5
c:5
三角形の面積:10.825318