1+1=2
那么
2-1=1是一定成立的么
public int proReverse(int x){
int result = 0;
while (x != 0) //假设输入1234
{
int tail = x % 10; //取到数字末尾4,3,2,1
int newResult = result * 10 + tail; //4,43,432,4321
if ((newResult-tail)/10!=result) //如果newResult超限 会越界变成负值或者正值
{ return 0; }
result = newResult; //4,43,432,4321
x = x / 10; //123,12,1,0 --> return
}
return result;
}