Two "bubble" loops in pseudocode; would they return the same thing?
In the first code, the values taken by $(c, d)$ are in the set $\{(c, d)| 1 \leq d &lt; c \leq x\}$. In the second code, the set is $\{(c,d)|1\leq c &lt; d \leq x\}$. Since $c$ and $d$ play symmetrical roles in the boolean test, it is expected that you obtain the same result.
Note that if $c$ and $d$ would not play symmetrical roles, the result could be different (for example, if the test was a, c * d, a = prod).