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