Scanf parses the arguments following the format string you gave it. So the first call expects to read num Scanf other_num to assing to num to a and other_num to b. You’ll see that if you call it like on of these:
In your case, calling it with 1 2 3 4 5 6 made it scan 1, discard 2 as it didn’t follow the format, and then went on to scan 3 on the next call, which discarded 4 and finally printed everything.