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