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