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