Question: My code prints the result of converting n into base B. I am using % in my code. If % of two numbers gives an output of for example "11", how to I separate the digits so my output looks like "1 1"

```
        String s;
        int r;

        if(n < b){
            return n + " ";
        }else{
            s = converting(n/b,b);
            r = (n % b);
        }
        return s + r;
    }

    public static void main(String[] args) {
        Scanner scnr = new Scanner (System.in);
        RecursionMethod num = new RecursionMethod();
        System.out.println("Enter Values: ");
        System.out.print("B: ");
        int first = scnr.nextInt();
        System.out.print("B: ");
        int second = scnr.nextInt();
        System.out.println("Result: " + num.converting(first,second));
        scnr.close();
    }
}

```

Answer: 
Try using a while loop:

```
int num; // = the int you want to separate

while (num > 0) {
   print( num % 10);
   num = num / 10;
}

```
Why not do the base conversion via [Integer.toString(int i, int radix)](https://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#toString(int,%20int)), where radix is just a fancy word for base, then use string manipulation as David Findlay suggests (though I'd probably use String#join and String#split), e.g.:

```
String converted = Integer.toString(n, b);
String spaceSeparated = (String.join(" ", converted.split("")));

```