Is This a Right Angled Triangle?

Published by Matt in

Given three numbers, x, y and z, determine whether they are the edges of a right angled triangle.

Examples

right_triangle(3, 4, 5) ➞ true
# This is the classic example of a "nice" right angled triangle.

right_triangle(145, 105, 100) ➞ true
# This is a less famous example.

right_triangle(70, 130, 110) ➞ false
# This isn't a right angled triangle.

Notes

  • Notice the largest side of the triangle might not be the last one passed to the function.
  • All numbers will be integers (whole numbers).
Watch a quick demo on how Edabit works.