> 其他 >
用C编程已知三角形的三条边长,面积.
要求用《C语言》编程.
人气:483 ℃ 时间:2020-03-25 14:59:42
解答
#include
#include
int main()
{
float a,b,c,t,s;
printf("输入三条边的长,中间用逗号隔开:");
scanf("%f,%f,%f",&a,&b,&c);
t=(a+b+c)/2;
s=sqrt(t*(t-a)*(t-b)*(t-c));
printf("\n这个三角形的面积是:%f\n",s);
return 0;
}
注释:运行的时候,如果出现错误,试着改变一下输入法,输入数据的时候特别是数据之间的逗号.两个数之间有个逗号,逗号对应的输入法是英语中使用的.
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版