fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. double calculate_area(double a, double b, double c) {
  5. double s = (a + b + c) / 2;
  6. double total = sqrt(s * (s - a) * (s - b) * (s - c));
  7. return total;
  8. }
  9.  
  10. int main() {
  11. double a, b, c;
  12.  
  13. printf("辺の長さ a, b, c : ");
  14. scanf("%lf %lf %lf", &a, &b, &c);
  15.  
  16. double total = calculate_area(a, b, c);
  17.  
  18. printf("面積: %lf\n", total);
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 5276KB
stdin
Standard input is empty
stdout
辺の長さ a, b, c : 面積: 0.000000