You are given an integer 51234 (say) we need to sort the digits of a number the output will be 12345.
How to do it without using array ?
General overview:
The only potentially tricky bit might be properly handling zeros - you don't want too many, and you'll want to handle the edge case where the input is zero properly.
Actual implementation is left as an exercise...