thanks for you comments guys.
@bguild. It is interesting to find out that somehow all the values (I printed off them allSystem.out.println("\nSide1 is " + side1 + " side2 is " + side2+ " hypothenuse is " + hypothenuse);
)
get to infinity, what I don't undestand is why they get to infinity in the first place. Then I realized that perhaps it's because I don't set any limit
to side1, side2 and hypothenuse, in that they keep incrementing, so that's might be why. SO I run a little test, and changed the three loops to this
for(int i = 0; i <= limitValue && side1 <= limitValue; i++,side1++){
side1 = Math.pow(side1, 2);
for(int j = 0; j <= limitValue && side2 <= limitValue; j++,side2++){
side2 = Math.pow(side2, 2);
for(int k = 0; k <= limitValue && hypothenuse <= limitValue; k++,hypothenuse++ ){
hypothenuse = Math.pow(hypothenuse, 2);
System.out.println("\nSide1 is " + side1 + " side2 is " + side2+ " hypothenuse is " + hypothenuse);
if((side1 + side2) == hypothenuse ){
System.out.printf("%f\t: %f\t: %f\t",
side1, side2, hypothenuse );
}//if
}//inner loop
}//side2 loop
}//outer loop
I added 3 more conditions to make sure that side1, side2 and hypothenuse don't grow to infinite, but still I got some funny output, here's what I got:
Side1 is 0.0 side2 is 0.0 hypothenuse is 0.0
0.000000 : 0.000000 : 0.000000
Side1 is 0.0 side2 is 0.0 hypothenuse is 1.0
Side1 is 0.0 side2 is 0.0 hypothenuse is 4.0 …