fork download
  1. #include<stdio.h>
  2. #include<math.h> //sqrt平方根函数需要这个头文件
  3. int main()
  4. {
  5. float a, b, c, p, S;
  6. printf("please input a b c:");
  7. scanf("%f%f%f", &a, &b, &c);
  8. p = (a + b + c) / 2;
  9. S = sqrt(p*(p-a)*(p-b)*(p-c));
  10. printf("S = %.2f\n", S);
  11. return 0;
  12. }
Success #stdin #stdout 0s 5316KB
stdin
7 8 9
stdout
please input a b c:S = 26.83