77.3k views
5 votes
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 a right triangle. Recall from the Pythagorean theorem that in a right triangle, the square of one side equals the sum of the squares of the other two sides. Use The triangle is a right triangle. and The triangle is not a right triangle. as your final outputs. An example of the program input and proper output format is shown below:Enter the first side: 3 Enter the second side: 4 Enter the third side: 5 The triangle is a right triangle.

User Auzy
by
7.9k points

1 Answer

1 vote

Answer:

def IsItRightTriangle(a, b, c):

if (a ** 2) + (b ** 2) == (c ** 2):

print("The triangle is a right triangle")

elif (a ** 2) + (b ** 2) != (c ** 2):

print("The triangle is not a right triangle")

a = int(input())

b = int(input())

c = int(input())

IsItRightTriangle(a, b, c)

Step-by-step explanation:

You didn't specify which programming language, so I wrote it in python! Hope this helps!

User Maharshi
by
7.4k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.