代码如下:
不知道等腰直角三角形怎样判断?
#include <stdio.h>
main()
{
int a,b,c;
printf("please input a,b,c:");
scanf("%d%d%d",&a,&b,&c);
/*first judge triangle*/
if(a+b>c&&a+c>b&&b+c>a)
/*second judge equilateral triangle*/
if(a==b&&a==c)
printf("a,b,c can form a equilateral triangle.");
else
/*third judge isosceles right-angled triangle*/
if((a==b||b==c||a==c)&&(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a))
printf("a,b,c can form a isosceles right-angled triangle.");
else
/*fourth judge isosceles triangle*/
if(a==b||b==c||a==c)
printf("a,b,c can form a isosceles triangle.");
else
/*fifth judge right-angled triangle*/
if(a*a+b*b==c*c||a*a+c*c==b*b||b*b+c*c==a*a)
printf("a,b,c can form a right-angled triangle.");
/*last trangle*/
else
printf("a,b,c can form a triangle.");
/*otherwise not triangle*/
else
printf("a,b,c can not form a triangle.");
getch();
}