fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. struct side {
  5. double a;
  6. double b;
  7. double c;
  8. };
  9.  
  10.  
  11.  
  12. int main(void) {
  13.  
  14. struct side t = {5,5,5};
  15. printf("a:%lf\nb:%lf\nc:%lf\n" ,t.a,t.b,t.c);
  16. double s,S;
  17. s = (t.a+t.b+t.c)/2;
  18. S = sqrt(s*(s-t.a)*(s-t.b)*(s-t.c));
  19.  
  20. printf("三角形の面積:%lf" ,S);
  21.  
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 5272KB
stdin
Standard input is empty
stdout
a:5.000000
b:5.000000
c:5.000000
三角形の面積:10.825318