Write a program that accepts the lengths of three sides of a triangle as inputs. The program output should indicate whether or not the triangle is an equilateral triangle.
Answers
Answer:
Python
Explanation:
print("Input lengths of the triangle sides: ")
x = int(input("x: "))
y = int(input("y: "))
z = int(input("z: "))
if x == y == z:
print("Equilateral triangle")
else:
print("Not Equilateral triangle")
Concept:
== is the equality operator. It checks if the values of two operands are equal or not.
Given:
Accept the lengths of three sides of a triangle as inputs and print whether or not the triangle is an equilateral triangle.
Find:
Write a program for the given statement.
Solution:
side_a = int(input("Enter the first side of the triangle: "))
side_b =int(input("Enter the second side of the triangle: "))
side_c = int(input("Enter the third side of the triangle: "))
if(side_a == side_b == side_c):
print("The given triangle is an equilateral triangle.")
else:
print("The given triangle is not an equilateral triangle.")
Output: