1. Engineering
  2. Computer Science
  3. in java...

Question: in java...

Question details
In java
Pythagoras Theorem is the well known theorem that the square on the hypotenuse of a right triangle is the same as the sum of the squares on the other two sides. A well known expression of this is a2 +b C2. It turns out that there are (infinitely many) integer solutions to this equation. These integer solutions are known as Pythagorean triples. The first of these is 3,4,5 since 32 +4 is 9 16 or 25 which is 52 You should write a program that takes a number from the user and finds all the Pythagorean triples where both a and b are less than or equal to the input value Implementation You may find it useful to find the square root of a number. To do this you can use the method from the API - Math.sqrt (d). This takes a double as a parameter and returns a double as esult. You can truncate a double d to store it in an int i by casting it-i = (int) d. This helps to determine if a number is a whole number Sample Output How high should I go? 12 3 4 5 5 12 13 6 8 10 9 12 15
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution