
/*
Online Java - IDE, Code Editor, Compiler

Online Java is a quick and easy tool that helps you to build, compile, test your programs online.
*/

public class Main
{
    static int[] ascending = new int[4];   
    static int[] descending = new int[4];  
    static int count;
    
    public static void main(String[] args) {
        System.out.println("Welcome to Online IDE!! Happy Coding :)");
        
        KaprekarConstant(1234, ascending, descending);
    }
    
    public static int KaprekarConstant(int number, int[] ascending, int[] descending)
    {
        int lastDigit=0;
        
        if ((number/10)==0)
        {
            count=0;
            System.out.println(number);
            return number;
        }
        
        lastDigit=number%10;
        
        System.out.println(lastDigit);
        
        count++;
        return KaprekarConstant(number/10, ascending, descending);
        
    }
    
}
