Because when num was 9, that meant num<=10 was true, so your while loop ran the num+=2 again.
num
num<=10
num+=2