The built-in Math.Pow() function in .NET raises a double base to a double exponent and returns a double result.
Math.Pow()
double
W
I cast the result into int, like this:
double exp = 3.0; int result = (int)Math.Pow(2.0, exp);
In this case, there are no rounding errors because base and exponent are integer. The result will be integer too.