00:01
We're going to verify how many times does the while loop execute in the pseudocode fragment below.
00:11
In the pseudocode we have a variable count equal to 12 and then the while loop consists of only one instruction and the condition is count greater than zero and instruction is count equal count minus 3.
00:30
So the options to the answer are 6, 5, 4 or 0.
00:36
Let's see here how this code will execute.
00:42
So we start by count being equal to 12.
00:47
We enter the while loop because count greater than zero which is the next verification is true because 12 is greater than zero and then we execute the operation count equal count minus 3 equal 9.
01:09
So count is equal to 9.
01:14
Let me put it down here.
01:18
After the while loop is executed the first time so we have one time here execution and the code is going to verify again the condition count greater than zero true.
01:34
So it's going to execute the instruction count equal its actual value minus 3.
01:42
The actual value of count now is 9 minus 3 is 6.
01:48
So count is equal to 6 and now the code is going to verify again count is positive or greater than zero and that is true.
01:58
6 is greater than zero and it executes again the instruction count equal the actual value of count minus 3 and that is 6 minus 3 equals 3...