Hanin Altarhuni
Hanin Altarhuni
7 years 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.

This Question Belongs to User Ask Question >> Miscellaneous

Join The Discussion

Comments ( 1 )

  1. Allibia Libya
    Allibia Libya :
    6 years ago

    4

Related User Ask Questions