题目
c语言程序设计 输入三角形的3条边a,b,c,如果能构成三角形,输入面积crea和周长preimeter(保留两位小数)
提问时间:2020-07-24
答案
#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(" These three sides can structure a triangle. ");
printf("The area of the triangle is %.2f. ", S);
printf("The perimeter of the triangle is %.2f. ", 2 * p);
}
}
#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(" These three sides can structure a triangle. ");
printf("The area of the triangle is %.2f. ", S);
printf("The perimeter of the triangle is %.2f. ", 2 * p);
}
}
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
最新试题
热门考点
- 1用简便方法计算下面各题. (1)2.9×0.45+0.29×4.2+0.029×13 (2)3.84×9.6+0.96×61.6.
- 2土壤是( ) ( )( )( )( )( )的混合物
- 3___the green dress?
- 4已知X等于根号3减根号2 求X的5次方+X的四次方-10倍的X的3次方-10倍的X的2次方+2X +1的值
- 5一道方程,2分之一x+4分之一=5分之8
- 6A Complete these sentences according to the clues in brackets.
- 7如图,在平行四边形ABCD中,E为BC边上一点,且AB=AE. (1)求证:△ABC≌△EAD; (2)若AE平分∠DAB,∠EAC=25°,求∠AED的度数.
- 8如何确定地图上河流的方向?
- 9一个花坛的形状如图的阴影部分,它的周长和面积各是多少?
- 10到亲戚家做客的作文400字