4-8 reversenumber

Post date: Feb 11, 2014 7:51:23 PM

package reversenumber;

import java.util.Scanner;

public class Reversenumber {

   

    public static void main(String[] args) {

       

        Scanner key=new Scanner(System.in);

        int x,r,m,s=0;

        

        System.out.print("enter the number:");

x=key.nextInt();

        m=x;

while (x!=0)

{

r=x%10;

          s=s*10+r;

         x=x/10;

}

        System.out.println("number:"+m+"and reverse number :"+s);

        


    }

}