Escolar Documentos
Profissional Documentos
Cultura Documentos
Console.Title = "MATRICES"
'Declaración de variables
Dim n As Integer 'filas
Dim m As Integer 'columnas
'Utilizamos el Do para no permitir valores negativos, ni ceros
Do
Console.Write("Ingrese el número de filas: ")
n = Console.ReadLine()
n -= 1 '
Console.Write("Ingrese el número de columnas: ")
m = Console.ReadLine()
m -= 1
If n >= 0 And m >= 0 Then
Exit Do
End If
If n < 1 Or m < 1 Then
Console.WriteLine("ERROR")
Console.WriteLine("Ingrese de nuevo")
Console.WriteLine()
Main()
End If
Loop
Console.WriteLine()
Dim iMatriz(n, m) As Integer
For i = 0 To n
For j = 0 To m
Console.Write("Ingrese el elemento {0}, {1} : ", i, j)
iMatriz(i, j) = Console.ReadLine()
Next
Console.WriteLine("│")
Next
For i = 0 To n
Dim s As String = " "
For j = 0 To m
s &= iMatriz(i, j)
s &= vbTab
Next
Console.WriteLine(s)
Next
End Sub