#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main() {
int a, b, c;
double p, s;
cin>>a>>b>>c;
p = (a + b + c) / 2.0;
s = sqrt(p * (p - a) * (p - b) * (p - c));
cout<<fixed<<setprecision(2)<<s;
return 0;
}
#include <stdio.h>
#include <math.h>
float calc(float a,float b,float c)
{
float p,s;
p=(a+b+c)/2.0;
s=sqrt(p*(p-a)*(p-b)*(p-c));
return s;
}
int main()
{
float a,b,c;
printf("Input a:");
scanf("%f",&a);
printf("Input b:");
scanf("%f",&b);
printf("Input c:");
scanf("%f",&c);
printf("area = %f",calc(a,b,c));
return 0;
}
对 楼上都对 先判断三角形 再用海伦公式