当前位置: > 编写程序,提示用户输入三角形的三条边长,判断该三角形是否为直角三角形,若是则输出结果以及三角形面积....
题目
编写程序,提示用户输入三角形的三条边长,判断该三角形是否为直角三角形,若是则输出结果以及三角形面积.

提问时间:2021-03-16

答案
#include
void main(void)
{
int a,b,c;
double S;
int TRUE = 0;
printf("Enter three numbers for sides of a triangle:");
scanf("%d %d %d",&a,&b,&c);
if(a * a + b * b == c * c)
{
TRUE = 1;
S = a * b / 2;
}
if(b * b + c * c == a * a)
{
TRUE = 1;
S = b * c / 2;
}
if(c * c + a * a == b * b)
{
TRUE = 1;
S = c * a / 2;
}
if(TRUE == 1)
{
printf(" It is a right angle triangle. ");
printf("And the area of the triangle is %lf. ",S);
}
}
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
版权所有 CopyRight © 2012-2019 超级试练试题库 All Rights Reserved.