Find a Nth highest or lowest number in a given series of numbers Using VB.NET

Rajnilari2015
Posted by Rajnilari2015 under VB.NET category on | Points: 40 | Views : 355
Suppose we have a collection of numbers (+ve, -ve, fractional) and we need to find out the MAX and MIN from that. The below code will help to do so

Dim lstNumbers As New List(Of Double)() From { _
1, _
2.06, _
34, _
-4, _
5.9, _
61.9, _
7.8, _
8, _
9, _
18.0, _
23.7 _
}

Dim minNum As Double = lstNumbers.Min() 'lowest number
Dim maxNum As Double = lstNumbers.Max() 'highest number
Console.WriteLine("Min = {0} , Max = {1}", minNum, maxNum)

Comments or Responses

Login to post response