eine Ganzzahl in Java umkehren
while(num != 0)
{
int digit = num % 10;
reversed = reversed * 10 + digit;
num /= 10;
}
Faithful Finch
while(num != 0)
{
int digit = num % 10;
reversed = reversed * 10 + digit;
num /= 10;
}
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int num = input.nextInt();
int rev = 0;
while (num > 0) {
rev = rev * 10 + num % 10;
num /= 10;
}
System.out.println(rev);
}