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