title: Modulo operator in Objective C
body: <p>From the "Programing in Objective C" (Kochan):</p>
  
  <p>Program 5.8 prompts the user to enter a number and then proceeds to display the digits
  from that number from the rightmost to leftmost digit.</p>
  
  <pre><code>// Program to reverse the digits of a number
  #import &lt;Foundation/Foundation.h&gt;
  
  int main (int argc, char *argv[])
  
  {
  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
  int number, right_digit;
  
  NSLog (@"Enter your number.");
  scanf ("%i", &amp;number);
  
  while ( number != 0 ) {
  right_digit = number % 10;
  NSLog (@"%i", right_digit);
  number /= 10;
  }
  
  [pool drain];
  return 0;
  }
  </code></pre>
  
  <p>My question is: what happening when user types in single digit number- 1 to 9 ? I couldn't find any material about such case. 
  After compilation the program just proceed with returning that single digit. Why is that? 
  I was trying to come up with code for this task and spend literally 2 hours, trying to incorporate loops and decision making for this " if number is single digit" problem. And the solution was so ignorant!    </p>