Answer:
In Python:
side1 = float(input("Side 1: "))
side2 = float(input("Side 2: "))
side3 = float(input("Side 3: "))
if side1>0 and side2>0 and side3>0:
if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:
if side1 == side2 == side3:
print("Equilateral Triangle")
elif side1 == side2 or side1 == side3 or side2 == side3:
print("Isosceles Triangle")
else:
print("Scalene Triangle")
else:
print("Invalid Triangle")
else:
print("Invalid Triangle")
Explanation:
The next three lines get the input of the sides of the triangle
<em>side1 = float(input("Side 1: "))
</em>
<em>side2 = float(input("Side 2: "))
</em>
<em>side3 = float(input("Side 3: "))
</em>
If all sides are positive
if side1>0 and side2>0 and side3>0:
Check if the sides are valid using the following condition
if side1+side2>=side3 and side2+side3>=side1 and side3+side1>=side2:
Check if the triangle is equilateral
<em> if side1 == side2 == side3:
</em>
<em> print("Equilateral Triangle")
</em>
Check if the triangle is isosceles
<em> elif side1 == side2 or side1 == side3 or side2 == side3:
</em>
<em> print("Isosceles Triangle")
</em>
Otherwise, it is scalene
<em> else:
</em>
<em> print("Scalene Triangle")
</em>
Print invalid, if the sides do not make a valid triangle
<em> else:
</em>
<em> print("Invalid Triangle")
</em>
Print invalid, if the any of the sides are negative
<em>else:
</em>
<em> print("Invalid Triangle")</em>