View Code of Problem 24

#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int a,b,c;
	while(~scanf("%d %d %d",&a,&b,&c)){
		double S=0,x=0;
		if(a+b>c&&b+c>a&&c+a>b){
				x=(a+b+c)/2.0;
				S=sqrt(x*(x-a)*(x-b)*(x-c));
		}
		printf("%.2f\n",S);
	}
}

Double click to view unformatted code.


Back to problem 24