I m encountering an extra garbage value at the end of o/p.
Can you please check the code
Printing o/p in increasing order
cout in the main is not required since you are already printing the result in the recursive function.
oh sorry…thank you.