implemented Pow(x, n) function