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