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