Matriz

Solo disponible en BuenasTareas
  • Páginas : 4 (936 palabras )
  • Descarga(s) : 0
  • Publicado : 17 de mayo de 2011
Leer documento completo
Vista previa del texto
Matriz
Private Sub Form_Load()
'Crear una matriz Bidimensional
Dim NF As Integer, NC As Integer ' Numero de filas & columnas
Dim F As Integer, C As Integer ' Fila & columna actualesDim Sumafila As Integer ' Suma de cada fila

NF = InputBox("Numero de filas de la matriz:")
NC = InputBox("Numero de Columnas de la matriz:")
ReDim m(1 To NF, 1 To NF)

'Entrada de datos
For F =1 To NF
For C = 1 To NC
m(F, C) = InputBox("m(" & F & ", " & C & ")=")
Next C
Next F

'Escribir la suma de cada fila
For F = 1 To NF
Sumafila = 0
For C = 1 To NC
Sumafila =sumafla + m(F, C)
MATRIZ 2
Dim m() As Integer
Dim x() As Integer
Private Sub Form_Load()
'Crear una matriz bidimensional
Dim NF As Integer
Dim NC As Integer 'numero de filas & de columnasDim F As Integer
Dim C As Integer 'Fila & columna actuales
Dim Sumafila As Integer 'Suma de cada fila

NF = InputBox("Numero de filas de la matriz:")
NC = InputBox("Numero de columnas de lamatriz:")
ReDim m(1 To NF, 1 To NC)
ReDim x(1 To NF, 1 To NC)

'Entrada de datos
For F = 1 To NF
For C = 1 To NC
m(F, C) = InputBox("(" & F & ", " & C & ")=")
Next C
Next F'Copiar la matriz m en la matriz x
For F = 1 To NF
For C = 1 To NC
x(F, C) = m(F, C)
Next C
Next F

'Escribir la suma fila cada fila
For F = 1 To NF
Sumafgila = 0
For C = 1 To NC
Sumafila =Sumafila + x(F, C)
Next C
Print "Suma de la fila"; F; "="; Sumafila
Next F

End Sub
MATRIZ COLUMNA
Private Sub Form_Load()
'Crear una matriz Bidimensional
Dim NF As Integer, NC As Integer 'Numero de filas & columnas
Dim F As Integer, C As Integer ' Fila & columna actuales
Dim SumaColumna As Integer ' Suma de cada columna

NF = InputBox("Numero de filas de la matriz:")
NC =InputBox("Numero de Columnas de la matriz:")
ReDim m(1 To NC, 1 To NC)

'Entrada de datos
For F = 1 To NF
For C = 1 To NC
m(F, C) = InputBox("m(" & F & ", " & C & ")=")
Next C...
tracking img