fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. struct Triangle{
  4. double a,b,c;
  5. };
  6. int main(void) {
  7. struct Triangle t;
  8. double p,s;
  9. scanf("%lf %lf %lf",&t.a,&t.b,&t.c);
  10. printf("a:%lf\nb:%lf\nc:%lf\n",t.a,t.b,t.c);
  11. p=(t.a+t.b+t.c)/2.0;
  12. s=sqrt(p*(p-t.a)*(p-t.b)*(p-t.c));
  13. printf("三角形の面積:%lf",s);
  14. return 0;
  15. }
  16.  
Success #stdin #stdout 0.01s 5316KB
stdin
3 4 5
stdout
a:3.000000
b:4.000000
c:5.000000
三角形の面積:6.000000