Changed loop variables from i and j to num1 and num2 for clarity.