Help!

Somehow my program keep printing the scalene triangle even when I put equilateral triangle or isosceles triangle =( Is it because of my formula or syntax?



#include <stdio.h>
#include <ctype.h>

int main(void)
{
int side1;
int side2;
int side3;


printf("This programm will recognize the type of triangles\n");
printf("Enter the value of side 1 : ");
scanf("%d%*c", &side1);
printf("Enter the value of side 2 : ");
scanf("%d%*c", &side2);
printf("Enter the value of side 3 : ");
scanf("%d%*c", &side3);

if(side1+side2>side3&&side2+side3>side1&&side1+side3>side2)
if(side1==side2!=side3)
{
printf("scalene triangle");
}
else
if(side1==side2&&side2==side3)
{
printf("equilateral triangle");
}
else
if(side1!=side2&&side2!=side3&&side1!=side3)
{
printf("isosceles triangle");
}
else
{
printf("not a triangle");
}



return 0;
}
Syntax.

if( side1 == side2 != side3 )

says to compare side1 to side2, evaluating to true or false, then compare either true or false to side3. side3 is true is side3 != 0 and false otherwise.
Topic archived. No new replies allowed.