大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
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); } };