public static boolean check(int a, int b, int c) {
return (a+b>c);
}
public static void triangleTriples(int[] a) {
for (int i = 0; i<a.length; i++) {
for (int j = i+1; j<a.length; j++) {
for (int k = j+1; k<a.length; k++) {
if (check(a[i],a[j],a[k]))
System.out.println(a[i] + " " + a[j] + " " + a[k]);
}
}
}
No comments:
Post a Comment