Solution 4:

Code:
i=0;~i<n;i--
this doesn't work, in fact prints x 21 times due to differences between 1 and 2 's complement.