输入三角形任意三条边,判断是否能够成三角形,如果可以构成三角形求面积C语言
展开全部
#include
void main()
{
int a,b,c;
printf("Please Input a,b,c:");
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
if(a+b<=c||a+c<=b||b+c<=a) /*判断是否能构成三角形*/
printf("No!\n");
else
{
printf("Yes!\n");
if(a==c||a==b||b==c) /*判断是否为等腰三角形*/
{
printf("It can be an isoceles triangle!\n");
if(a==c && a==b) /*判断是否为等边三角形*/
printf("It also can be an equilateral triangle!\n");
else
printf("But it can not be an equilateral triangle!\n");
}
else
{
printf("It can't be an isoceles triangle!\n");
}
}
getch();
}
void main()
{
int a,b,c;
printf("Please Input a,b,c:");
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
if(a+b<=c||a+c<=b||b+c<=a) /*判断是否能构成三角形*/
printf("No!\n");
else
{
printf("Yes!\n");
if(a==c||a==b||b==c) /*判断是否为等腰三角形*/
{
printf("It can be an isoceles triangle!\n");
if(a==c && a==b) /*判断是否为等边三角形*/
printf("It also can be an equilateral triangle!\n");
else
printf("But it can not be an equilateral triangle!\n");
}
else
{
printf("It can't be an isoceles triangle!\n");
}
}
getch();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询