C# program to create a tuple to find out Even/Odd numbers

Rajnilari2015
Posted by Rajnilari2015 under C# category on | Points: 40 | Views : 244
The below program will do so

static Tuple<List<int>, List<int>> GetEvenOddNumbers()
{
var numbers = Enumerable.Range(1, 20); //generate numbers between 1 to 20
return
Tuple
.Create
(
numbers.Where(i=>i%2==0).ToList() //find even numbers list
, numbers.Where(i => i % 2 != 0).ToList() //find odd numbers list
);
}

Comments or Responses

Login to post response