4-8 reversenumber

posted Feb 11, 2014, 11:51 AM by dldar masud   [ updated Feb 16, 2014, 2:54 AM by Karwan Jacksi ]

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);
        
    }
}

ċ
Reversenumber.java
(0k)
Karwan Jacksi,
Feb 11, 2014, 11:51 AM
Comments