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