123456789101112131415161718192021222324252627282930 |
- public class SpecialPythagoreanTriplet {
- private int triplet;
- public int findPythagoreanTriplet() {
- int product = 0;
- for (int a = 1; a < 1001; a++) {
- for (int b = 1; b < 1001; b++) {
- for (int c = 1; c < 1001; c++) {
- if (a + b + c == 1000 && (a*a + b*b) == c*c)
- product = a * b * c;
- else
- continue;
- }
- }
- }
- return product;
- }
- }
|