Java Blog

 
 
 
import java.io.*;

class  Reverse
{
    public static void main(String args[]) 
    {
            String str;
             int no,k,rev;
             rev=0;

             try{
                    BufferedReader obj = new BufferedReader(new InputStreamReader(System.in));
                    System.out.print(\"Enter Number you want to reverse : \");
                    System.out.flush();

                    str=obj.readLine();
                    no=Integer.parseInt(str);

                          while(no > 0)
                           {
                                k = no %   10;
                                 rev = rev * 10 + k; 
                                no=no/10;
                           }

                    System.out.println(\"Reverse Number is : \"+rev);
                }

                catch(Exception e)
                {}
    }
}

    Related Post:
  1. RMI application for getting the final total price of the shopping list with some of the following items and quantities chosen by the user

  2. Program using Switch case to compute the net amount to be paid by a customer

  3. Program to show the use of For Loop

  4. Program which will read a string and rewrite it in the alphabetical order

  5. Develop a RMI based application for addition of two complex numbers

  6. Program to show an example of using Abstract Class and Abstract Method

  7. An applet program to display Vertical Color Bar

  8. Pass the marks of 10 students from the client side design a servlet, which takes these marks and returns the number of students who obtained first cls

  9. Program to search an element in an array using Linear Search

  10. Program of insertion sort

  11. Program to show an example of Multiple Levels of Inheritance

  12. Program to show an example of extraction of characters from a StringBuffer objects

  13. Program to show the use of the Continue Statement

  14. Program of an applet to display alternate filled and empty circle

  15. Program to show an example of Polymorphism

  16. Program to determine the sum of the following harmonic series for a given value of n

  17. Program to show an example of Calling a Base Class Method from a Derived Class

  18. Program to show insertion of StringBuffer, String objects and other Basic Data Types into a StringBuffer object

  19. Program to show an example of using a Non-Static Nested Class

  20. Develop a game application in CORBA for which the player will guess a number between 1 to 100, which will be compared to the random number generated b

 
 
Didn't find what you were looking for? Find more on Program to reverse the number eg given no : - 12345, output want :- 54321