Create a method called power that takes base and expo as parameters
Check if the expo is equal to 0. If it is return 1 (This is our base case for the method, where it stops. This way our method will call itself "expo" times). If expo is not 0, return base * power(base, expo-1). (Call the method itself, decrease the expo by 1 in each call and multiply the base)
The following code is written in Java. I created both versions of the program that was described in the question. The outputs can be seen in the attached images below. Both versions are attached as txt files below as well.