Skip to content

Code written in Java that searches for any combination of numbers between 1-500 that get the same results of the Pythagorean theorem equation: a^2 + b^2 = c^2

License

Notifications You must be signed in to change notification settings

mikestratton/Java-Pythagorean-Theorem-Algorithm--Brute-Force-Example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Java-Pythagorean-Theorem-Algorithm--Brute-Force-Example

Code written in Java that searches for any combination of numbers between 1-500 that get the same results of the Pythagorean theorem equation: a^2 + b^2 = c^2

Requirements of the were as stated in the book: Java How to Program: Exercise 4.21 page 165

"A right triangle can have sides whose lengths are all integers. The set of three integer values for the lengths of the sides of a right triangle is called a Pythagorean Triple. The lengths of three sides must satisfy the relationship that the sum of the squares of two of the sides is equal to the square of the hypotenuse.Write an application that displays a table of Pythagorean triples for side1, side2, and hypotenuse,all no longer than 500. Use a triple-nested for loop that tries all possibilities. This method is an example of “brute force” computing. You’ll learn in more advanced computer science courses that for many interesting problems there is no known algorithmic approach other than sheer brute force. Algebra equation for a Pythagorean Triple is:(aa) + (bb) = (c*c)"

About

Code written in Java that searches for any combination of numbers between 1-500 that get the same results of the Pythagorean theorem equation: a^2 + b^2 = c^2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages