Err... it doesn't. That code does not work at all. It will infinitely loop, spitting out ever larger numbers.
Each of your loops has a problem. On line 21:

for (n = 2 ; n <= 10 ; n=n++)
 
That
n=n++
is very very very bad. It results in undefined behavior. You must never modify a variable more than once in the same sequence. ++ already increments n, so there's no need to reassign it

for (n = 2 ; n <= 10 ; n++) // < better
 
Your other loop is also messed up:

for (n = 2 ; n <= n+2 ; n = n+2)
 
Think about that condition for a second:
n <= n+2
. When will that ever be false? If n=4, then you're comparing 4<=6 (true). Or if n=10, you're comparing 10<=12 (also true). Bottom line is it will always
^{*} be true, so this loop is infinite.
^{*} Actually this isn't actually correct... it will just loop for a very very long time, until 'n' wraps past the boundaries of an int.
Also, you should not be using the same loop counter (n) for both loops. Changes made to 'n' in the inner loop will affect the outer loop as well, since they're both using the same variable.