View Code of Problem 24

#include <stdio.h>
#include <math.h>
int main(){
	int a,b,c,sum;
	float s;
	while(scanf("%d%d%d",&a,&b,&c) != EOF)
	{
		if(a + b < c)
			printf("输入不正确!");
		else if(a + c < b)
			printf("输入不正确!");
		else if(c + b < a)
			printf("输入不正确!");
		else {
			sum = (a + b + c)/2;
			s = sqrt(sum * (sum - a) * (sum - b) * (sum - c));
			printf("%0.2f\n",s);
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 24