Write a program that displays all pythagorean pairs x and y, where x < 50 and y < 50. Also show, for each such pair, sqrt(x2 + y2).
(Note. You can tell whether a number is a prefect square by taking its square root, rounding it to the nearest integer, and checking whether the square of the rounded square root is the same as the starting number. Here are definitions of two functions: issqrt(n) is the closest integer to the square root of n, and isPerfectSquare(n) yields true if n is a perfect square. Library function real(n) convert integer n to a real number and round(x) rounds to the nearest integer. Add these to your program.
Define isqrt(n: Integer): Integer by isqrt(n) = round(sqrt(real(n))) %Define Define isPerfectSquare(n: Integer): Boolean by isPerfectSquare(n) = result | Let s: Integer = isqrt(n). Let result: Boolean = (s*s == n). %Define