Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Euler2 {
- public static void main(String[] args) {
- int a, b, c, d;
- double f, g, h;
- for (a = 0; a <= 1000; a++) {
- for (b = 0; b <= 1000; b++) {
- for (c = 0; c <= 1000; c++) {
- d = a + b + c;
- f = Math.pow(a, 2);
- g = Math.pow(b, 2);
- h = Math.pow(c, 2);
- if (d == 1000 && a < b && b < c && f + g == h) {
- System.out.println(a + " " + b + " " + c);
- break;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement