View Single Post
Old Jan 16th, 2006, 5:39 PM   #3
smg1001
Newbie
 
Join Date: Jan 2006
Posts: 10
Rep Power: 0 smg1001 is on a distinguished road
Thanks for the reply. Ok, here's what I have. It works but only for an array size of 3:

for(int i = 0; i < g.length; i++) {
for(int j = 0 ; j < g.length; j++) {
for(int k = 0; k < g.length; k++) {
if( (h[i] + h[j] + h[k] == 6) && (i != j) && (j != k) ) {
System.out.println("A = " + h[i] + " i = " + i);
System.out.println("B = " + h[j] + " j = " + j);
System.out.println("C = " + h[k] + " k = " + k);
System.out.println();
numPrinted++;
}
count++;
}
}
}

where h[3] = {1, 2, 3} and g.length = 3
smg1001 is offline   Reply With Quote