Hanin Altarhuni
Hanin Altarhuni
7 days ago

consider the following power function how many multiplications are executed as a result of the call power (5.0,3)? (exclude divisions in this total)

double power (double base , unsigned int exponent)
{
if (exponent == 0)
return 1.0;
else
if (even(exponent))
return power (base * base ,exponent);
else return power(base*base,exponent/2)*base;
}

A. 4

B. 9

C. 6

D. 8

Solution(By Examveda Team)

this program give error as even function is not define.

Join The Discussion

Related User Ask Questions