//三角形//
#include<stdio.h>
int main()
{
int edge1;
int edge2;
int edge3;
printf("请输入3条边长:");
scanf("%d%d%d",&edge1,&edge2,&edge3);
if((edge1<1)||(edge2<1)||(edge3<1)){
printf("非法数据!!!");
return 1;
}
printf("由3条边长为:%d,%d,%d的三边",edge1,edge2,edge3);
if((edge1+edge2>edge3)&&(edge1+edge3>edge2)&&(edge2+edge3>edge1)){
printf("能组成三角形。");
}else{
printf("不能组成三角形。");
}
return 0;
}
//直角三角形//
#include<stdio.h>
int main()
{
int edge1;
int edge2;
int edge3;
printf("请输入3条边长:");
scanf("%d%d%d",&edge1,&edge2,&edge3);
if((edge1<1)||(edge2<1)||(edge3<1)){
printf("非法数据!!!");
return 1;
}
printf("由3条边长为:%d,%d,%d的三边",edge1,edge2,edge3);
if((edge1*edge1+edge2*edge2==edge3*edge3)||(edge1*edge1+edge3*edge3==edge2*edge2)||(edge2*edge2+edge3*edge3==edge1*edge1)){
printf("能组成直角三角形。");
}else{
printf("不能组成直角三角形。");
}
return 0;
}