Power Your Software Testing 
 with AI and Cloud
Supercharge QA with AI for Faster & Smarter Software Testing

Reversing a number involves swapping the digit at the first position with the last digit and the second digit with the second last digit, and so on until the middle digit.
Here are the steps to reverse the number.
Now let’s look at the below Java program that prints the number in reverse order.
import java.util.Scanner;
public class Reverse
{
    public static void main(String args[])
    {
        int x, y, k = 0;
        Scanner s = new Scanner(System.in);
        System.out.print("Enter the number you want to reverse:");
        x = s.nextInt();
        while(x > 0)
        {
            n = x % 10;
            k = k * 10 + y;
            x = x / 10;
        }
        System.out.println("Reverse number is "+k);
    }
}
KaneAI - Testing Assistant
World’s first AI-Native E2E testing agent.

Get 100 minutes of automation test minutes FREE!!