2
Reply

Splitting An Integer By Using Recursive Function.

Murali Reddy

Murali Reddy

11y
1.5k
1
Reply

    I think, u need to use "while(num>0)" instead of "if(num>0)".

    public class Sample

    {
    public static int num=123456789;
    public static void main()
    {
    split(num);
    console.readkey();
    }
     public static void split(int num)
            {
                if(num>0)
                {
                    split(num / 10);
                    Console.WriteLine(num % 10);
                }
            }
    }