Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
class Solution {
public:
int reverse(int x) {
int s=0;
while(x!=0)
{
s=s*10+x%10;
x=x/10;
}
return s;
}
};