import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int rev = 0 ; 
        if(n<0){ n = n * -1 ; } 
        while(n>0){
            int last = n % 10;
            System.out.println("Current Number --> " + last) ; 
            rev = rev * 10 + last ;
            n = n/10 ;
            
        }
        System.out.print("Reversed Number = " + rev);
        
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: