How to reverse a number as an integer and not as a string?

algorithm, c#

Solution

This should do it:

int n = 12345;
int left = n;
int rev = 0;
while(Convert.ToBoolean(left)) // instead of left>0 , to reverse signed numbers as well
{
   int r = left % 10;   
   rev = rev * 10 + r;
   left = left / 10;  //left = Math.floor(left / 10); 
}

Console.WriteLine(rev);

Problem

I came across a question "How can one reverse a number as an integer and not as a string?" Could anyone please help me to find out the answer? Reversal should reverse the decimal digits of the number, i.e. use base 10.

Original source