Loop stopped at i = 10 and num = 40