The code in the loop changes the value of num. j is unchanged.