c语言程序设计 输入三角形的3条边a,b,c,如果能构成三角形,输入面积crea和周长preimeter(保留两位小数)

问题描述:

c语言程序设计 输入三角形的3条边a,b,c,如果能构成三角形,输入面积crea和周长preimeter(保留两位小数)
1个回答 分类:综合 2014-11-09

问题解答:

我来补答
#include
#include
void main(void)
{
double a, b, c, S, p;
int TRUE = 0;
printf("Enter three numbers for sides of a triangle: ");
scanf("%lf %lf %lf", &a, &b, &c);
if((a + b > c) && (b + c > a) && (c + a > b))
{
TRUE = 1;
p = (a + b + c) / 2;
S = sqrt(p * (p - a) * (p - b) * (p - c));
}
if(TRUE == 1)
{
printf("\nThese three sides can structure a triangle.\n");
printf("The area of the triangle is %.2f.\n", S);
printf("The perimeter of the triangle is %.2f.\n", 2 * p);
}
}
 
 
展开全文阅读
剩余:2000
上一页:周五
下一页:责任的事实论据