Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

reverse number java

import java.util.Scanner;

public class App1 {
    public static void main(String[] args) {
        Scanner scannerNum = new Scanner((System.in));
        int number , sum = 0;
        number = scannerNum.nextInt();

       
        System.out.println("sum = " + sum);*/
        int result = 0 , digit;
        while(number != 0)
        {
            result *= 10;
            digit = number % 10;
            result += digit;
            number = number / 10;
        }
        System.out.println("result = " + result);


    }
}
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #reverse #number #java
ADD COMMENT
Topic
Name
2+1 =