// 给出三角形的三边长,求三角形面积 // area = sqrt( s * ( s - a ) * ( s - b ) * ( s - c ) ) // s = ( a + b + c) / 2 #include <stdio.h> #include <math.h> int main() { int a,b,c; double s,area; printf("请输入三角形三个边长:"); scanf("%d%d%d",&a,&b,&c); s = ( a + b + c) / 2; area = sqrt( s * ( s - a ) * ( s - b ) * ( s - c ) ); printf("三角形面积是:%f\n",area); return 0; } <img src="http://img.blog.csdn.net/20150423120515092?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhhb3lhcWlhbjU1Mg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />
时间: 2024-10-12 02:51:23