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