#include<stdio.h>
int which_triangle(int a,int b,int c)
{
if( !(a&&b&&c&&(a+b)>c&&(a+c)>b&&(b+c)>a) )
return 4;
else if(a==b && a==c)
return 3;
else if(a==b || a==c || b==c)
return 2;
else
return 1;
}
int main()
{
int a,b,c,x;
printf("enter 3 side length : ");
scanf("%d %d %d",&a,&b,&c);
x=which_triangle(a,b,c);
switch(x){
case 1:
printf("\nScalene Triangle\n");
break ;
case 2:
printf("\nIsoscalene Triangle\n");
break ;
case 3:
printf("\nEquilateral Triangle\n");
break ;
case 4:
printf("\nError\n");
break ;
}// end of switch
return 0;
}
Let me know your thoughts.