source code to find first three smallest values in an array....for eg,a[]={20,18,2,10,5,90}answer should be 2,5,10........can anyone give me a suggestion.....
Hi Priya,Create one vb.net web application and replace page load method with following
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim MyArrList As ArrayList = New ArrayList() 'Initialize Array MyArrList.Add(20) MyArrList.Add(18) MyArrList.Add(2) MyArrList.Add(10) MyArrList.Add(5) MyArrList.Add(90) 'Sort elements in array to get smallest value MyArrList.Sort() 'For displaying result Dim sbResult As StringBuilder = New StringBuilder() For I As Integer = 1 To 3 Step 1 If I = 3 Then sbResult.Append(MyArrList(I - 1).ToString()) Else sbResult.Append(MyArrList(I - 1).ToString() + ", ") End If Next 'Displaying result on browser Response.Write("Smallest Three values are: " + sbResult.ToString()) End Sub