# Recursion Logic Required

Posted by Akki_shah under C# on 9/22/2011 | Points: 10 | Views : 1084 | Status : [Member] | Replies : 1
Hi,

I have some number ranges like (2,3) (4,5) (6,7)

now i want to write a recursion function on this number and out put required is the permutation combination of all these numbers. i can write for loop but the problem is these ranges can very.
the output i want is like thils .
2,4,6
2,4,7
2,5,6
2,5,7
3,4,6
3,4,7
3,5,6
3,5,7

 0 Hope this helps ``` var query = (from value1 in Enumerable.Range(2, 2) from value2 in Enumerable.Range(4, 2) from value3 in Enumerable.Range(6, 2) select new { value1, value2, value3 }).ToList(); ``` Result ```{ value1 = 2, value2 = 4, value3 = 6 } { value1 = 2, value2 = 4, value3 = 7 } { value1 = 2, value2 = 5, value3 = 6 } { value1 = 2, value2 = 5, value3 = 7 } { value1 = 3, value2 = 4, value3 = 6 } { value1 = 3, value2 = 4, value3 = 7 } { value1 = 3, value2 = 5, value3 = 6 } { value1 = 3, value2 = 5, value3 = 7 } ``` Best Regards, Niladri BiswasAkki_shah, if this helps please login to Mark As Answer. | Alert Moderator