This Reverse Number using Java program prints reverse number using numeric operations i.e. if the input is 564 then output will be 465. we can see after reversing the integer is print the integer digits in reverse order.
Here is the Java Example for the program ReverseNumber :
import java.util.Scanner; public class ReverseNumber { public static void main(String[] args) { try { System.out.println("Enter a number to Reverse"); Scanner in = new Scanner(System.in); int num = in.nextInt(); int NumberReverse = 0; int remainder = 0; while(num > 0) { remainder = num %10; NumberReverse = NumberReverse * 10 + remainder; num = num /10; } System.out.println("The Reversed Number is: " + NumberReverse); } catch (Exception e){} } }