Firstly I have to admit I'am beginner in VB.net. I have this code that have to sort array in ascending order. Firstly it will request how much array size and then insert a data. But I face problem to make it working .Can anyone help me for this? Below is my code :
Module Module1
Sub Main()
Dim A(20) As Integer
Dim num, i, j, k, arr, temp As Integer
Console.Write("enter size num:")
Dim add = Console.ReadLine
If Integer.TryParse(add, num) Then
'Console.WriteLine("valid. num = " & num)
For i = 0 To num - 1
Console.Write("enter num:")
A(i) = Console.ReadLine
Next i
For i = 0 To num - 1
For j = i + 1 To num - j
If A(i) > A(j) Then
temp = A(i)
A(i) = A(j)
A(j) = temp
End If
Next j
Console.Write(A(i))
Next i
Else
Console.WriteLine("Invalid.Data is not number")
End If
Console.ReadLine()
End Sub
End Module
Thanks and any help will be greatly appreciate.
Array.Sort(A)