十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
class Solution { public: int reverse(int x) { int num = 0,X=x; int count = 0; double sum = 0; while (X != 0) { X = X/ 10; count++; } for (int i = 0; i < count; i++) { num = x % 10; sum = sum * 10 + num; if (sum>INT_MAX || sum < INT_MIN) { return 0; break; } x = x / 10; } return int (sum); } };