You can do it in RPGLE very easily using the Eval statement.
You use “**” as the mathematical operator which means “raise to the power of”. So, the following line will work:
Eval Result = X **n
All the best
Register Hereor login if you are already a member