00:01
Okay, so in this question we have two values, two integer value x and y.
00:08
We do things to x and y with these two while loops and when we're done we output x and y.
00:21
So basically we want to know what will be the final value of x and y, what will be printed by this code segment.
00:28
We're using blue and red to keep track of x and y.
00:31
We're going to go through this code segment and see what comes out at the end what will be the final two values of it so x starts at 10 and y starts at zero while x is greater than 5 well 10 is greater than 5 so i'm good i can enter y is equal to 3 now i already i have a small mistake in my color code so it was 0 but now it's equal to 3 while y is less than x so is 3 less than 10? yes, y is multiplied by 2.
01:13
Now my y is equal to 6.
01:17
And if y percent x equal 1, that means if the remainder of the division between y of y by x is 1, i add 5.
01:30
But 6 divided by 10 is 0 times 10 plus 6, so it's not equal to 1, so i don't do anything.
01:37
So i go back on top of this while is y less than x so six is indeed less than 10.
01:46
I multiply y by two so i have 12.
01:52
Now here is 12 divided by 10 is 1 times 10 plus 2.
01:59
So this here is not equal to 1 so i don't do anything.
02:04
I go back up here is y less than 10.
02:08
Well 12 is not less than 10.
02:10
So i don't do anything.
02:11
I quit this while loop.
02:14
Now i go to x equal minus equal three.
02:19
Now my x is equal to seven.
02:22
Now i'm less with seven and twelve.
02:25
And then i go back up.
02:27
Is x greater than five? well, seven is greater than five...