#!/usr/bin/env swift; import Foundation import Utils func exponentiation(_ base:Double, _ powerArg:Int) -> Double { var power:Int = powerArg var result:Double = 1 while power > 0 { result *= base power -= 1 } return result } // Begin Main for b:Double in stride(from: 1.1, to: 2.05, by: 0.1) { for p:Int in 2...10 { print(Utils.format("{0:f} ^ {1:d} = {2:f}", b, p, exponentiation(b, p))) } } exit(EXIT_SUCCESS)