Udemy coupon 100 off 2017 ::Udemy coupon code free :: Get 100+ Free Udemy coupons Here

Find out Reverse Number of a given Number.

Find out Reverse Number of a given Number.

Out Put is as following :


Source code: 

import java.io.*;
class ReverseOfNum 
{
public static void main(String args[]) throws IOException
{
int num, temp,reverse=0;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
   System.out.println("Enter the Number You Want to Reverse : ");
num=Integer.parseInt(br.readLine());

while(num>0)
{
temp=num%10;
reverse=reverse*10+temp;
num=num/10;

}
System.out.println("Result is  : " + reverse);
}
}

  • Save the file with name ReverseOfNum .java 
  • Complie with: javac ReverseOfNum .java
  • Run with: java ReverseOfNum