Ejercicios de programación .net (nivel inicial)
Se muestra el funcionamiento de los conceptos básicos para programar en .net
Se muestra el funcionamiento de los conceptos básicos para programar en .net
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Matrices<br />
Public Class Form1<br />
Private Sub Button1_Click(ByVal sen<strong>de</strong>r As System.Object, ByVal e As System.EventArgs)<br />
Handles Button1.Click<br />
Dim f1, c1, f2, c2, cont As Integer<br />
'ingrese valores <strong>de</strong> matrices<br />
f1 = InputBox("Ingrese Fila Matriz 1")<br />
c1 = InputBox("Ingrese Columna Matriz 1")<br />
f2 = InputBox("Ingrese Fila Matriz 2")<br />
c2 = InputBox("Ingrese Columna Matriz 2")<br />
Dim mat1(f1, c1), mat2(f2, c2), matp(f1, c2) As Integer<br />
If c1 = f2 Then<br />
'matriz 1<br />
For i = 1 To f1<br />
For j = 1 To c1<br />
mat1(i, j) = InputBox("Ingrese Valores Matriz 1")<br />
ListBox1.Items.Add(mat1(i, j))<br />
Next<br />
Next<br />
'matriz 2<br />
For i = 1 To f2<br />
For j = 1 To c2<br />
mat2(i, j) = InputBox("Ingrese Matriz 2")<br />
ListBox2.Items.Add(mat2(i, j))<br />
Next<br />
Next<br />
'producto<br />
For i = 1 To f1<br />
For j = 1 To c2<br />
For kf = 1 To c1<br />
cont = mat1(i, kf) * mat2(kf, j) + cont<br />
Next<br />
matp(i, j) = cont<br />
ListBox3.Items.Add(matp(i, j))<br />
cont = 0<br />
Next<br />
Next<br />
Else<br />
MsgBox("Error")<br />
End<br />
End If<br />
End Sub<br />
End Class<br />
Leonel Navarrete