Created
April 14, 2017 15:35
-
-
Save LuxXx/91ada301ff41f414536bff876982fb03 to your computer and use it in GitHub Desktop.
Project Euler - Problem 9
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
package euler; | |
public class Triplet { | |
public static void main(String[] args) { | |
int n = 1000; | |
for (int a = 1; a < n; a++) { | |
for (int b = a; b < n; b++) { | |
for (int c = b; c < n; c++) { | |
if (a*a + b*b == c*c && a+b+c == n) { | |
System.out.println(a*b*c); | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment