Java Program To find a reverse of a input number

      No Comments on Java Program To find a reverse of a input number
import java.util.Scanner;
class scan
{
 public static void main(String arg[])
  {
  int x,y=0;
   Scanner kb=new Scanner(System.in);
   System.out.println("Enter Any Number:- ");
  x=kb.nextInt();
while(x>0)
  {
   
          y = y * 10;
          y = y + x%10;
          x = x/10;
 
  } 
 System.out.print("Reverse of a number is:- "+y);  
    
  }
}

OUTPUT:-

Leave a Reply

Your email address will not be published. Required fields are marked *