Programmatically check if a number is a palindrome
<p>This sounds like homework, yes it is <strong>(of someone else)</strong>, i ask a friend of mine who is learning C# to lend me some of his class exercises to get the hang of it.</p>

<p>This is actually the first time i ever put hands to write C# code, i didn't even did a "hello world". But thats not the problem.</p>

<p>The problem are <a href="http://en.wikipedia.org/wiki/Palindromic%5Fnumber" rel="nofollow">Palindromic numbers</a>, don't remember learning about it, i only knew them at Wikipedia.</p>

<p>So as the Question title says it. How could i write a code that would check for these kind of numbers.</p>

<p>I'm not asking for C# source code (although its very useful), but i would be more happy that someone had the time to explain how should the code behave and work to search for these number, those principles that should work for most programming languages in searching for these numbers.</p>

<p>Thanks guys.</p>

<p><hr></p>

<p><strong>The Solution:</strong></p>

<p>First i must say that this is the first question where i found a big effort and fun from all the community in this question. I really like that :D</p>

<p>Thanks for that. Well "statikfx", searched in SO for this (i did too but no good), and he found the <a href="http://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>

<p>I could post the C# code, but as i first said my gold as having a solution for all languages. And this its just that.</p>

<p>I think this is a more simple and lighter solution, and so far it as got it right.</p>

<p><strong>My thanks to all you guys. Just Great.</strong></p>
