Control Flow & Loop Tracing

Answer & solution
Official answer: 46
Approach: The first loop finds the highest decimal place value. The second consumes digits from left to right and retains alternating positions.
For n=14362, t grows through 1,10,100,1000,10000,100000. The condition then fails and t is divided by 10, giving 10000.
The digit iterations are: d=1, remainder 4362, turn=0, so skip; d=4, remainder 362, turn=1, so newnum=4; d=3, remainder 62, turn=0, so skip; d=6, remainder 2, turn=1, so newnum=10×4+6=46; d=2, remainder 0, turn=0, so skip. The place value becomes zero and the loop ends.
The program therefore prints 46, the digits in positions two and four from the left. The alternating flag is tested before it is toggled, so the first digit is skipped. For this concrete input all arithmetic fits in int; possible overflow for much larger arguments is irrelevant to this execution.