Runtah
Friday, February 13, 2015
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);
}
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.