Java Basic Programs

Reverse Number

In this tutorial, our task is:

  • to reverse the given number
  • print the reversed number


Give number: 1345

Reverse number: 5431


Given below is the java program to reverse the given number.

public class ReverseNumber {


      public static void main(String[] args) {

            int n = 1345;

            int reverse=0;



                  reverse = reverse*10 + n%10;

                  n = n/10;










Please Share this page
Views : 72
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!