add 2D array values

hi everyone!
i have a problem with 2D array and tried this for 2 days.
array is m*n and want to add values. explained in following example.

1 2 3
4 5 6
7 8 9
10 11 12

outputs:
1 + 4 + 7 + 10
1 + 4 + 7 + 11
1 + 4 + 7 + 12
1 + 4 + 8 + 10
1 + 4 + 8 + 11
1 + 4 + 8 + 12
1 + 4 + 9 + 10
1 + 4 + 9 + 11
1 + 4 + 9 + 12
1 + 5 + 7 + 10
1 + 5 + 7 + 11
1 + 5 + 7 + 12
1 + 5 + 8 + 10
1 + 5 + 8 + 11
1 + 5 + 8 + 12
1 + 5 + 9 + 10
1 + 5 + 9 + 11
1 + 5 + 9 + 12
1 + 6 + 7 + 10
1 + 6 + 7 + 11
1 + 6 + 7 + 12
1 + 6 + 8 + 10
1 + 6 + 8 + 11
1 + 6 + 8 + 12
1 + 6 + 9 + 10
1 + 6 + 9 + 11
1 + 6 + 9 + 12
and in case of 2 and 3, add sequence are same as 1

thanks
Last edited on
Very nice.
Topic archived. No new replies allowed.