Код: Выделить всё
int reverse(int x) {
if (x==0){
return 0;
}
bool n = false;
if (x0){
int rem;
rem = x%10;
x = x/10;
if ( (num*10) > (pow(2,31)-1) || (num*10) < -pow(2,31)){
return 0;
}
num = num*10 + rem;
}
if(n==true){
num = -num;
}
return num;
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... n-type-int