fonction de puissance
int power(int base, int exponent)
{
if(exponent == 0)
return 1;
else
return base*power(base, exponent-1);
}
Bad Bird
int power(int base, int exponent)
{
if(exponent == 0)
return 1;
else
return base*power(base, exponent-1);
}
def my_pow(x, n):
if n == 0:
return 1
if x != 0 and n < 0:
return 1/x * my_pow(1/x, -(n+1))
return my_pow(x*x, n/2) if n % 2 == 0 else x * my_pow(x, n-1)