private double Power(double a, double n)
{
double mult = 1;
for(int i = 1; i <= n; i++)
{
mult = mult * a;
}
return mult;
}
How it works:
mult=1, i = 1
n = 5, a = 2
mult = 1 * 2 = 2
mult=2, i=2
n=5, a=2
mult=2 * 2 = 4
and so on..