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
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);