k++ is performed only n^2 times.
For each i it is set to i+1 at the beginning of for-j loop and is
increasing with every k++ operation. But k can not be more than n. So
for each i, j goes from i to n, and k goes from i+1 to n.

Reply via email to