j = -j; // j is currently negative so it flips back to positiveNSLog(@"%i", j); // prints 154 again

So what is happening is the user types in a negative number, that is obviously less than zero, so your loop enters and turns it into a positive number, this is then clearly greater than zero so the condition is no longer met and your loop exits. If the user enters a positive number, your loop is completely ignored. You might as well have written:

The code itself is fine but were its located is not. The problem is that it is not within a function or method that is being called, and therefore its not being run at all. For the purpose of this program I would recommend you just put it in main for the moment like this: