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. double p;
  15. p=(tri.a+tri.b+tri.c)/2;
  16. double t;
  17. t=p*(p-tri.a)*(p-tri.b)*(p-tri.c);
  18. double s;
  19. s=sqrt(t);
  20. printf("a=%lf,b=%lf,c=%lf\n",tri.a,tri.b,tri.c);
  21. printf("s=%lf",s);
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
a=0.000000,b=0.000000,c=0.000000
s=0.000000