Created
December 24, 2009 11:07
-
-
Save Riduidel/263147 to your computer and use it in GitHub Desktop.
This file contains 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
range = 1..100; | |
squareSum = range.inject (0, {sum, number -> | |
sum+=(number*number) | |
}); | |
println squareSum; | |
sum = range.inject (0, {sum, number -> | |
sum+=(number) | |
}); | |
sum *=sum; | |
println sum-squareSum; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment