0% found this document useful (0 votes)
30 views2 pages

Sub Dim As Integer Dim: "Ingrese Numero de Elementos A Ordenar: "

The document contains code to create a 1-dimensional array in VB, populate it with incrementing numbers from 1 to the array size, and output the contents by looping through and printing the index and value of each element. It demonstrates initializing and accessing elements of a 1D array, as well as a basic for loop.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views2 pages

Sub Dim As Integer Dim: "Ingrese Numero de Elementos A Ordenar: "

The document contains code to create a 1-dimensional array in VB, populate it with incrementing numbers from 1 to the array size, and output the contents by looping through and printing the index and value of each element. It demonstrates initializing and accessing elements of a 1D array, as well as a basic for loop.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

1 Module Module1

Dim arrayunidimensional(3) As Integer


Dim x, num As Integer
Sub Main()
For x = 0 To 3

num = x + 1
arrayunidimensional(x) = num
Next
Console.WriteLine()
Console.WriteLine("arrayunidimensional4")
Console.WriteLine("arrayunidimensional4")
For x = 0 To 3
Console.WriteLine("indice [{0}{1}{2}", x, ")]=",
arrayunidimensional(x))
Next
Console.ReadLine()

End Sub

End Module

3 module Module1

Sub Main()
Dim arryunidimensional(9) As Integer
Dim x, num As Integer c
For x = 0 To 9
num = x + 1
arryunidimensional(x) = num
Next
Console.WriteLine()
Console.WriteLine("arryunidimensional9")
Console.WriteLine("arryunidimensional9")
For x = 0 To 9
Console.WriteLine("indice [{0} {1} {2}", x, ")]=",
arryunidimensional(x))
Next
Console.ReadLine()
End Sub

End Module

4 Sub Main()
Dim x, i, n, num, temp As Integer
Dim v(49)
Console.WriteLine("Ingrese Numero de elementos a ordenar: ")
n = Console.ReadLine
For x = 0 To n - 1
Console.WriteLine("Ingrese Numero:")
num = Console.ReadLine
v(x) = num
Next x
For i = 1 To n
For j = n - 1 To i Step -1
If v(j - 1) > v(j) Then
temp = v(j - 1)
v(j - 1) = v(j)
v(j) = temp
End If
Next j
Next i

For x = 0 To n
Console.WriteLine("{0}", v(x))
Next
Console.Read()
End Sub

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy