fork download
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. float triangleArea(float a, float b, float c) {
  5. float s = (a + b + c) / 2;
  6. return sqrt(s * (s - a) * (s - b) * (s - c));
  7. }
  8.  
  9. int main() {
  10. float a, b, c;
  11.  
  12. printf("Enter 3 sides: ");
  13. scanf("%f %f %f", &a, &b, &c);
  14.  
  15. printf("Area = %.2f\n", triangleArea(a, b, c));
  16.  
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5280KB
stdin
3 4 5
stdout
Enter 3 sides: Area = 6.00