Combinations in Arrays

Hey Guys,
I have a problem where I have been given an array of some size n (Marks[n]) and I want to go through all possible combinations of all sizes from 1-n of the array elements.
For e.g., If the array has 5 elements the combinations would be
(Combinations of 5)
0 1 2 3 4 5

(Combinations of 4)
0 1 2 3
0 1 2 4
0 1 3 4
0 2 3 4
1 2 3 4

(Combinations of 3)
0 1 2
0 1 3
0 1 4
0 2 3
0 2 4
0 3 4
1 2 3
1 2 4
1 3 4
2 3 4

(Combinations of 2)
0 1
0 2
0 3
0 4
1 2
1 3
1 4
2 3
2 4
3 4

(Combination of 1)
0
1
2
3
4

I need to go through each set like this to perform some function
Can someone please help me ?

Thanks
Topic archived. No new replies allowed.