1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| public class RightTriangle {
| public static void main(String[] args) {
| int a = Integer.parseInt(args[0]);
| int b = Integer.parseInt(args[1]);
| int c = Integer.parseInt(args[2]);
| int a1, a2, last, first, middle;
|
| a1 = Math.min(a, b);
| a2 = Math.max(a, b);
| last = Math.max(a2, c);
| a2 = Math.min(a2, c);
| first = Math.min(a1, a2);
| middle = Math.max(a1, a2);
|
| boolean r1 = first > 0;
| boolean r2 = middle > 0;
| boolean r3 = last > 0;
|
| boolean result = (first * first + middle * middle) == (last * last);
| System.out.println(r1 && r2 && r3 && result);
| }
| }
|
|