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