Answer
2 1 2 1 2 1 2 1
Work Step by Step
n = 4
Outer loop:
k=1,2,3,4 → 4 iterations
Inner loop:
j=n/2=2
j = 2 → print 2
j = 1 → print 1
j = 0 → exit
So inner prints: 2, 1
Outer loop repeats this 4 times → sequence printed:
2
1
2
1
2
1
2
1