I need a simple c# program that accepts two inputs from the user. One is the base number and one is the exponential power number.

I then need a loop to calculate the answer.

Here is my problem.

First thing if the exponent is zero then the answer must be zero.

Second thing if hte exponent is one then the answer is the base number times 1.

Now if the exponent is not zero or one then...

I need to first take the base number times itself then each loop I need to take the previous answer and

multiply it by the base number.

Sounds simple I know but I am lost. Does this require a nested loop? One loop to get the base times itself then another loop to keep adding the new total times the base number. I guess I have to add some code in case the user enters 0 or 1?

Any suggestions would be greatly appreciated!

Below is the code I currently have to work with:

P.S. I am getting two errors. One says unreachable code is detected and the other error says not all code paths return a value?

public double Calculate() { double basenumber = double.Parse(textBoxBase.Text); int powernumber = int.Parse(textBoxPower.Text); double answer = 0.0; int countInteger = 0; { for (countInteger = powernumber; countInteger > 0; countInteger--) { if (powernumber == 1) { answer = basenumber * powernumber; } if (powernumber == 0) { answer = basenumber * powernumber; } else { answer *= powernumber; } return answer; }