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")
Step-by-step explanation:
The next three lines get the input of the sides of the triangle
side1 = float(input("Side 1: "))
side2 = float(input("Side 2: "))
side3 = float(input("Side 3: "))
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
if side1 == side2 == side3:
print("Equilateral Triangle")
Check if the triangle is isosceles
elif side1 == side2 or side1 == side3 or side2 == side3:
print("Isosceles Triangle")
Otherwise, it is scalene
else:
print("Scalene Triangle")
Print invalid, if the sides do not make a valid triangle
else:
print("Invalid Triangle")
Print invalid, if the any of the sides are negative
else:
print("Invalid Triangle")