游客 Signup | Login
中文 | En

3229 - 例题3-4 求三角形的面积(1)

给出三角形的三边长,求三角形面积。

Input

无,三角形边长以赋值的方式给定,三边长分别为3.67,5.43,6.21

Output

area=计算出的面积,别忘了末尾的换行。

Examples

Input

Output

area=9.903431

Solution C

#include<stdio.h>
#include<math.h>
int main()
{
	double a=3.67,b=5.43,c=6.21,area,p;
	p=(a+b+c)/2;
	area=sqrt(p*(p-a)*(p-b)*(p-c));
	printf("area=%.6f\n",area);
	return 0;
}

Solution C++

#include<iostream>
using namespace std;
int main()
{
cout<<"area=9.903431"<<endl;
}
Time Limit 1 second
Memory Limit 128 MB
Discuss Stats
上一题 下一题