Created
December 20, 2010 04:31
-
-
Save DarrenN/748016 to your computer and use it in GitHub Desktop.
Project Euler #9 in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for n in 0..100 | |
for m in 1..100 | |
if (m>n) | |
a = 2*m*n | |
b = (m**2 - n**2) | |
c = (m**2 + n**2) | |
end | |
if (a + b + c == 1000) | |
puts "Triplet = #{a} + #{b} = #{c} of which the product is #{a*b*c}" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment