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. int main(void)
  10. {
  11. struct Triangle t;
  12. double s;
  13. double temp;
  14. double menseki;
  15.  
  16. scanf("%lf",&t.a);
  17. scanf("%lf",&t.b);
  18. scanf("%lf",&t.c);
  19.  
  20. s=(t.a+t.b+t.c)/2.0;
  21. temp=s*(s-t.a)*(s-t.b)*(s-t.c);
  22. menseki=sqrt(temp);
  23.  
  24. printf("a:%lf\n",t.a);
  25. printf("b:%lf\n",t.b);
  26. printf("c:%lf\n",t.c);
  27. printf("三角形の面積:%lf\n",menseki);
  28.  
  29. return 0;
  30. }
  31.  
  32.  
  33.  
Success #stdin #stdout 0.01s 5320KB
stdin
Standard input is empty
stdout
a:0.000000
b:0.000000
c:0.000000
三角形の面積:0.000000