namespace ExponentApp
{
using static System.Console;
class MainClass
{
static void Main()
{
var value = 2;
var exponent = 3;
var result = ExponentCalculator.Calculate(value, exponent);
WriteLine($"The result is {result}");
}
}
}
namespace ExponentApp
{
using static System.Console;
public static class ExponentCalculator
{
public static int Calculate(int value, int modulus)
{
if (modulus == 1) return value;
return value * Calculate(value, modulus - 1);
}
}
}