import java.io.*;
class simple_reverse_of_given_number
{
public static void main(String args[])
{
int rev=0,n,no,rem;
try
{
DataInputStream cin=new DataInputStream(System.in);
System.out.println("Enter number to print its reverse number");
n=Integer.parseInt(cin.readLine());
no=n;
while(no!=0)
{
rem=no%10;
rev=rev*10+rem;
no=no/10;
System.out.println(rem);
}
System.out.println(n+" of reverse is "+rev);
}
catch(Exception e)
{
System.out.println("wrong input");
}
}
}
No comments:
Post a Comment