domingo, 22 de mayo de 2011
ORDEN DE SERIE DE NÚMEROS EN V.B.NET
Module OrdenNumeros
Sub Main()
'EDICIÓN DE LA CONSOLA
Console.Title = "NUMEROS ORDENADOS DE MENOR A MAYOR"
Console.BackgroundColor = ConsoleColor.DarkYellow
Console.Clear()
Console.ForegroundColor = ConsoleColor.Green
'DECLARACIÓN DEL ARREGLO Y LECTURA DE LOS NÚMEROS
Dim numero(5) As Integer
For n = 0 To 5
Console.WriteLine("ingrese numero: " & n + 1)
numero(n) = Console.ReadLine
Next
'PROCESO
Dim aux
For n = 0 To 4
For k = n + 1 To 5
If numero(n) > numero(k) Then
aux = numero(n)
numero(n) = numero(k)
numero(k) = aux
EndIf
Next
Next
'SALIDA
Console.WriteLine(vbNewLine)
Console.WriteLine("Los números ordenados de menor a mayor son:")
For k = 0 To 5
Console.WriteLine("{0}", numero(k))
Next
Console.ReadLine()
End Sub
End Module
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario