title: Programmatically check if a number is a palindrome
body: <p>This sounds like homework, yes it is <strong>(of someone else)</strong>, I asked a friend of mine who is learning C# to lend me some of his class exercises to get the hang of it.</p>
  
  <p>So as the title says: How can I check if a number is a <a href="http://en.wikipedia.org/wiki/Palindromic_number" rel="nofollow noreferrer">Palindrome</a>?</p>
  
  <p>I'm not asking for source code (although its very useful), but rather that someone explained how should the code should work, so that it can be applied to many different languages.</p>
  
  <hr>
  
  <p><strong>The Solution:</strong></p>
  
  <p>@statikfx searched SO for this and found the <a href="https://stackoverflow.com/questions/199184/how-do-i-check-if-a-number-is-a-palindrome/199218#199218">solution</a>.</p>
  
  <pre><code> n = num;
   while (num &gt; 0)
   {
        dig = num % 10;
        rev = rev * 10 + dig;
        num = num / 10;
   }
  // If (n == rev) then num is a palindrome
  </code></pre>