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 z = {5,5,5};
  12. double o,s;
  13.  
  14. o=(z.a+z.b+z.c)/2.0;
  15. s=sqrt(o*(o-z.a)*(o-z.b)*(o-z.c));
  16.  
  17. printf("自身で入力した3辺の長さは%.3f,%.3f,%.3f",z.a,z.b,z.c);
  18. printf("\n");
  19. printf("面積は%lf",s);
  20.  
  21.  
  22.  
  23. return 0;
  24. }
  25.  
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
自身で入力した3辺の長さは5.000,5.000,5.000
面積は10.825318