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,x;
  14.  
  15. scanf("%lf %lf %lf",&t.a,&t.b,&t.c);
  16.  
  17. p=(t.a+t.b+t.c)/2;
  18. x=p*(p-t.a)*(p-t.b)*(p-t.c);
  19. s=sqrt(x);
  20.  
  21. printf("a: %lf\n",t.a);
  22. printf("b: %lf\n",t.b);
  23. printf("c: %lf\n",t.c);
  24. printf("三角形の面積: %lf",s);
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 5288KB
stdin
5 5 5
stdout
a: 5.000000
b: 5.000000
c: 5.000000
三角形の面積: 10.825318