subject
Mathematics, 30.09.2019 22:20 ghernadez

The following recursive method calculates 3n : // precondition: n > = 0 public int power3(int n) { if (n == 0) // if n equals to 0 return 1; else { int p = power3(n/2); // when n is odd, n/2 is truncated to an integer // e. g., 7/2 gives 3 and 1/2 gives 0 p *= p; // multiply p by itself if (n % 2 == 1) // if n is odd p *= 3; // multiply p by 3 return p; } } how many multiplications will be performed when the program calls power3(15)?

ansver
Answers: 3

Another question on Mathematics

question
Mathematics, 21.06.2019 19:00
Witch represents the inverse of the function f(x)=1/4x-12
Answers: 1
question
Mathematics, 21.06.2019 22:40
Awoman has 14 different shirts: 10 white shirts and 4 red shirts. if she randomly chooses 2 shirts to take with her on vacation, then what is the probability that she will choose two white shirts? show your answer in fraction and percent, round to the nearest whole percent.
Answers: 3
question
Mathematics, 22.06.2019 00:00
Parallelogram efgh is a rectangle. he = 6, and fe = 8. find ge: and find fj:
Answers: 1
question
Mathematics, 22.06.2019 00:40
‼️‼️‼️‼️‼️the pressure exerted on the walls of a container by a gas enclosed within it is directly proportional to the temperature of the gas. if the pressure is 6 pounds per square inch when the temperature is 440 f, find the pressure exerted when the temperature of the gas is 380°f. (show work)
Answers: 1
You know the right answer?
The following recursive method calculates 3n : // precondition: n > = 0 public int power3(int n...
Questions
Questions on the website: 13722367