Java program to Reverse the given number

[java]class Reverse{
public static void main(String args[]){
int num = Integer.parseInt(args[0]); //take argument as command line
int remainder, result=0;
remainder = num%10;
result = result * 10 + remainder;
num = num/10;
System.out.println("Reverse number is : "+result);


8 thoughts on “Java program to Reverse the given number

  1. sorry to say your source code is not usefull because the adds cover your code its not able to see your code.

  2. class reverse
    public void main(int a)
    int b=a/1000
    int c=a%1000
    int d=c/100
    int e=c%100
    int f=e/10
    int g=e%10
    int a1=1000*g+100*f+10*d+b

    i think the integer a1 will have many memory allocation units in contrast to integer a which i think has only one units.IWOULD BE GRATEFUL TO YOU IF U READ THIS AND REPLY WHAT IS MY MISTAKE.

  3. class Sha{
    public static void main(String[] args){
    int n=1234,reverse=0;
    System.out.println(“Enter your number to reverse”);
    reverse = reverse*10;
    reverse = reverse+n%10;
    n = n/10;
    System.out.println("Reverse number is =" +n);
    getting output as same 🙁

Leave a Reply

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

Get the latest updates on your inbox

Be the first to receive the latest updates from Codesdoc by signing up to our email subscription.