Reverse Integer

问题:翻转数字
分析:注意初始化

class Solution {
public:
    int reverse(int x) {
        int y=0;
        while(x)
        {
           y=(y*10)+x%10;
           x/=10;
        }
        return y;
    }
};

  

原文地址:https://www.cnblogs.com/zsboy/p/3885645.html