ReverseNumber

Run Settings
LanguageJava
Language Version
Run Command
class Main { public static void main(String[] args) { System.out.println("Hello World!"); int num = 54321, reversed = 0; System.out.println("Original Number: " + num); // run loop until num becomes 0 while(num != 0) { // get last digit from num int digit = num % 10; reversed = reversed * 10 + digit; // remove the last digit from num num /= 10; } System.out.println("Reversed Number: " + reversed); } }
Editor Settings
Theme
Key bindings
Full width
Lines