Комментарии:
Thanks so
ОтветитьShould be clear in the title that you use a string. Most interviews won't allow that
ОтветитьOne another easy way to reverse the number --
private static void reverseTheNum(int n){
int reversed = 0;
for(int i = 1; n>0; i++){
int temp1 = n%10;
n = n/10;
reversed = reversed*10 + temp1;
}
System.out.println(reversed);
}