#### helloITSme

##### New member

- Joined
- Jul 16, 2019

- Messages
- 1

- Programming Experience
- Beginner

I need a way to generale all possible combinations and subset of the numbers.

I need to have all subsets (all subsets of 1 element, all subset of 2 elements, all subset of n elements) an of each subset all possible permutations.

I don't have idea

ALL combination!

Is there a quick way?

For example result should be:

1

1 2

1 3

1 4

1 2 3

1 2 4

1 3 4

1 2 3 4

2

2 3

2 4

2 3 4

3

3 4

4

this my code :

for (int i = 0; i < (2^4)-1; i++)

{

for (int j = 0; j < i+1; j++)

{

for (int k = j; k < i; k++)

{

Console.Write(k+1);

}

Console.WriteLine();

}

}

This my output

NOTE :This my question in Stackoverflow and not solution Because they think it is duplicate