Update TablesOfSquaresAndCubes.java

Another way without using Math.pow