I want to create a function that will print values of a given vector in a specific order: zeros, ones, numbers divisible by 2, numbers divisible by 3 (not by 2,excl.0), numbers divisible by 5 (not by 2 and 3, excl. 0), etc.
Would it be a good idea to use some vartiation of "bubble sort"? I think that a basic idea is to have if condition based on
if (x[i] %% divisor == 0 && x[i+1] %% divisor != 0)
I also know that I should have a loop that will increase "divisor" values every turn, but besides I don't really know how to start. I was able to comprehend basic "bubble sort" algorithm, but it seems that I have too many gaps to work this out comfortably.