im wrote a program to determine weather a triangle is scalene, isosceles or equilateral based on the given side lengths...its not working properly..i.e its giving isoceles when i enter data for an equilateral...etc etc... i fugured it was my logic in writing the program that was missing something....could anyone tell me how to tighten this up so that it works properly?
#include <stdio.h>
main () {
double side1, side2, side3 ;
int abc;
printf ("enter first side : ");
scanf ("%lf", &side1);
printf ("enter second side : ");
scanf ("%lf", &side2);
printf ("enter third side : ");
scanf ("%lf", &side2);
if ((side1 == side2)&&(side2 == side3)&&(side3 == side1))
printf ("Equilateral Triangle");
else if ((side1==side2)||(side2==side3)||(side3==side1))
printf ("Isosceles Triangle");
else if ((side1 != side2)&&(side2 != side3)&&(side3 !=side1))
printf ("Scalene Triangle");
scanf ("%d", &abc);
return (0);
}
the scanf at the end is to keep the program on the screen after it executes and displays the output..it usually does that (im using bloodshed's DevC++).
im guessing that there is something else i could put into the if statement's conditions, but im not sure at all... thanks in advance for your help