solution to Pow(x,n)