Wednesday, 28 August 2013

Write a program to sort and display an array of integers in ascending order using the concept of array in VB. Net .

 Private Sub Command1_Click()
arr = 0
Print "Your array contains: "
For k = 0 To num - 1
    Print "A"; "("; arr; "):"; A(k)
    arr = arr + 1
Next k
End Sub
Private Sub Form_Load()
num = InputBox("Intialize the size of your array:")
For i = 0 To num - 1
    A(i) = InputBox("Enter your array: ")
Next i

'this will sort your array in ascending order
For i = 0 To num - 1
    For j = i + 1 To num - 1
        If A(i) > A(j) Then
            temp = A(i)
            A(i) = A(j)

No comments:

Post a Comment