2个回答
展开全部
#include <stdio.h>
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("\nIt is a right angle triangle.\n");
printf("And the area of the triangle is %lf.\n", S);
}
}
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("\nIt is a right angle triangle.\n");
printf("And the area of the triangle is %lf.\n", S);
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询