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