A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a2 + b2 = c2For example, 32 + 42 = 9 + 16 = 25 = 52.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
loop: for (int a=1; a<1000; a++) { for (int b=1; b<1000;b++ ) { for (int c=1; c<1000; c++) { if (a+b+c==1000&&c*c==a*a+b*b) { System.out.println(a); System.out.println(b); System.out.println(c); System.out.println(a*b*c); break loop; } } } }
Lösung: 31875000