Enter a number: 5
To what power? 8
5 in power of 1 is: 5
5 in power of 2 is: 25
5 in power of 3 is: 125
5 in power of 4 is: 625
5 in power of 5 is: 3125
5 in power of 6 is: 15625
5 in power of 7 is: 78125
5 in power of 8 is: 390625

You could use Recursion
with care, as it could be very memory consuming.

You can download this example here(needed tools can be found in the right menu on this page).