asked 193k views
0 votes
Write a program to input 3 sides of a triangle and print whether it is an equilateral, scalene or isosceles triangle. a = int(input("Enter first side : ")) b = int(input("Enter second side : ")) c = int(input("Enter third side : ")) if a == b and b == c : print("Equilateral Triangle") elif a == b or b == c or c == a: print("Isosceles Triangle") else : print("Scalene Triangle")

asked
User Jeffjv
by
8.1k points

1 Answer

6 votes

Final answer:

To determine the type of triangle based on input sides, use code that checks for equality in the sides.

Step-by-step explanation:

To write a program that determines whether a triangle is equilateral, scalene, or isosceles based on the input of its three sides, you can use the following code:

a = int(input("Enter first side : "))
b = int(input("Enter second side : "))
c = int(input("Enter third side : "))

if a == b and b == c:
print("Equilateral Triangle")
elif a == b or b == c or c == a:
print("Isosceles Triangle")
else:
print("Scalene Triangle")

In this program, the user is prompted to enter the three sides of the triangle. The program then checks if all three sides are equal, if two sides are equal, or if no sides are equal to classify the triangle accordingly.

Learn more about Triangle classification

answered
User Riiich
by
8.0k points

No related questions found