Skip to content

Instantly share code, notes, and snippets.

@LuxXx
Created April 14, 2017 15:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LuxXx/91ada301ff41f414536bff876982fb03 to your computer and use it in GitHub Desktop.
Save LuxXx/91ada301ff41f414536bff876982fb03 to your computer and use it in GitHub Desktop.
Project Euler - Problem 9
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