fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3. struct data{
  4. double a;
  5. double b;
  6. double c;
  7. };
  8. int main(void) {
  9. double s,v;
  10. struct data g;
  11. scanf("%lf,%lf,%lf",&g.a,&g.b,&g.c);
  12. s=(g.a+g.b+g.c)/2;
  13. v=sqrt(s*(s-g.a)*(s-g.b)*(s-g.c));
  14.  
  15.  
  16. printf("s = %.2f, s = %.2f, s = %.2f\n", g.a, g.b, g.c);
  17. printf("面積 v = %lf\n", v);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5284KB
stdin
5,5,5
stdout
s = 5.00, s = 5.00, s = 5.00
面積 v = 10.825318