Kizmit903 Kizmit903
  • 13-08-2020
  • Computers and Technology
contestada

Give a tight bound on the number of times the z = z + 1 statement is executed. i = 2 while ( i > 1 ) { i = floor(i/2) z = z + 1 }

Respuesta :

IfeanyiEze8899 IfeanyiEze8899
  • 17-08-2020

Answer:

zero ( 0) times.

Explanation:

In the code;

i = 2

while ( i > 2){

     i = floor( i/2 );

     z = z + 1;

}

the variable " i " is assigned the integer " 2 ", then the while statement loops with a condition of a greater " i " value and divides the value by two for every loop.

But in this case, the while statement is not executed as the value of " i " which is 2 is not greater than but equal to two.

Answer Link

Otras preguntas

Samantha has 45books.she can pack 7 books in box how many boxes can she completely fill how books will be let
connor used. 5/6 inch of wire to make a small hook. how many hooks cab he make with 10 inches of wire?
Is anger a adjective or noun
What is the relationship between biotic and abiotic factors?
PLEASE PLEASE HELP ME give me 5 facts about LOS ANGELES
how did agriculture developed differently in the middle and southern colonies than it did in new england
How do you work out 3.29 x 40
Kendra is buying bottled water for a class trip. She has 16 bottles left over from the last trip. She buys bottles by the case to get a good price. Each case ho
what group is generally held responsible for the terror attacks of september,11 2001?
The quotient of twice a number p and 14.