I am preparing for an interview and I am not able to solve one of the problem.
Below is the problem:
Take number and print it as character one by one without using any inbuilt java conversion function.
Below is the example lets say you have one numnber 1234 and now write function to take this number as integer and print character array {1,2,3,4}.
It asked to write this function without using any inbuilt java conversion
Please let me if any one knows how to solve it.
This is the general idea of the algorithm, modify it to create a char array instead of printing the results:
I wrote it using a recursive algorithm, because I fancy recursion … but it’s trivial to convert this to an iterative solution.