Step through it with a debugger and see what happens.
8 6 4 and 2 are obvious.
When num is 2, num is decremented by 2 and becomes 0.
The loop at line 8 continues because the condition is >= 0.
At line 10, 0 % 5 has no remainder, so line 12 is executed.
num becomes 1 and the loop returns to the top.
line 15 outputs 1 and num is decremented by 2 becoming -1.
The loop stops because num is no longer >= 0.