Showing posts with label reverse. Show all posts
Showing posts with label reverse. Show all posts

Friday, February 13, 2015

Java program to reverse a given number

Java program to reverse a given number

class Reverse
{
public static void main(String...s)
{
int n,rev=0,i;
n=Integer.parseInt(s[0]);

while(n!=0)
{
i=n%10;
rev=(rev*10)+i;
n/=10;
}

System.out.println("
Reverse="+rev);

}
}
Read more »