-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem-9.java
More file actions
27 lines (23 loc) · 758 Bytes
/
problem-9.java
File metadata and controls
27 lines (23 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public class Problem9 {
public static void main(String[] args) {
int a = 0;
int b = 0;
int c = 0;
for (int i = 1; i < 1000; i++) {
for (int j = 1; j < 1000; j++) {
for (int k = 1; k < 1000; k++) {
if (i*i + j*j == k*k) {
if (i + j + k == 1000) {
a = i;
b = j;
c = k;
}
}
}
}
}
System.out.println("The Pythaogorean Triple is: (" + a + "," + b + "," + c + ")");
long product = a*b*c;
System.out.println("The product of the three is: " + product);
}
}