Module Module1
Sub Main()
Dim arreglo() As Integer = {1, 5, 6, 2, 8, 3}
Dim n As Integer = 5
Dim i, j, temp As Integer
Console.WriteLine(" ARREGLO ORIGINAL: 1, 5, 6, 2, 8, 3")
Console.ReadLine()
Console.WriteLine("===================================")
For i = 0 To n - 1
For j = 0 To n - 1
If arreglo(j) > arreglo(j + 1) Then
temp = arreglo(j)
arreglo(j) = arreglo(j + 1)
arreglo(j + 1) = temp
End If
Next j
Next i
Console.Write(" SU ARREGLO QUEDA ASI: ")
For i = 0 To 5
Console.Write(arreglo(i) & " ")
Next
Console.ReadLine()
End Sub
End Module
No hay comentarios:
Publicar un comentario