import org.pureprogrammer.Utils; public class Functions4 { static double exponentiation(double base, int powerArg) { int power = powerArg; double result = 1; while (power > 0) { result *= base; --power; } return result; } public static void main(String[] args) { for (double b = 1.1; b < 2.05; b += 0.1) { for (int p = 2; p <= 10; ++p) { System.out.println(Utils.format("{0:f} ^ {1:d} = {2:f}", b, p, exponentiation(b, p))); } } } }