You Are Reading

0

Reversed Numbers in Java

BufferedReader
Sample Output:

package javaapplication1;

public class ReservedNumbers {

public static void main(String[] args) {

int n = 12345;

int t,r = 0;

System.out.println("The original numbers : " + n);

do

{

t = n % 10;

r = r * 10 + t;

n = n / 10;

}

while (n > 0);

System.out.println("The reversed numbers : " + r);

}

}

0 comments:

Post a Comment

 
Copyright 2010 BufferedReader