77.7k views
22 votes
What is the value of numC at the end of this loop? numC = 12 while numC > 3: numC = numC / 2 numC =

User Komu
by
4.5k points

1 Answer

7 votes

Answer: 3

Step-by-step explanation:

Given :

numC = 12

while numC > 3:

numC = numC / 2

Initial value of numC = 12

The condition checks if the value of numC is greater than 12, only then will the statement be executed and the loop isn't altered

numC = 12 is greater Than 3 ;

numC = numC/2 = 12/2 = 6

numC is now 6 ;

numC = 6 is greater than 3

numC = numC / 2 = 6/2

numC is now 3

numC = 3 is not greater than 3 ; hence, loop terminates (condition isn't met)

Hence , numC = 3

User Jakub Kukul
by
4.6k points