Write a program in VB.net to find the Even/Odd numbers using Tuple

Rajnilari2015
Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 1866
The following program will do so

Private Shared Function GetEvenOddNumbers() As Tuple(Of List(Of Integer), List(Of Integer))
Dim numbers = Enumerable.Range(1, 50)
'generate numbers between 1 to 50
'find even numbers list
'find odd numbers list
Return Tuple.Create(numbers.Where(Function(i) i Mod 2 = 0).ToList(), numbers.Where(Function(i) i Mod 2 <> 0).ToList())
End Function

Comments or Responses

Login to post response