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