fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes h
  5. double a,b,c,p,S;
  6. printf("请输入三角形的三条边长:");
  7. scanf("%lf%lf%lf",&a,&b,&c);
  8. p=(a+b+c)/2.0;
  9. S=sqrt(p*(p-a)*(p-b)*(p-c));
  10. printf("该三角形的面积为:%.2f",S);
  11. return 0;
  12. }
  13.  
Success #stdin #stdout 0s 5292KB
stdin
15 26 17
stdout
请输入三角形的三条边长:该三角形的面积为:120.90