I want to write a code to find all combinations of 4 numbers, for example

numbers = 1,2,3,4
combinations are:
1
2
3
4
12
13
14
23
24
34
123
134
234
124
1234

Plz help i am unable to understand the logic...
thanks in advance...

One way to think about it is that you have 4 numbers -- therefore, you have four positions.
Each number must appear in each position a certain number of times (6).

If you write out all of the permutations with a text editor, you will see how they need to flow.

Ususally, however, you will need to have 4 digits on each line.
And I'm assuming the numbers can't repeat.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.