Textos escolares
- 1 For j = 0 To m.GetLength(0) - 1 Console.Write("{0}", m(i, j)) Next Console.WriteLine() Next For i = 0 To m.GetLength(0) - 1 s = 0 For j = 0 To m.GetLength(0) - 1 t = m(i, j) If t > s Then s = m(i, j) End If Next Console.WriteLine("el numero mayor de la fila {0} es ={1}", (i + 1), s) Next Console.Read() End Sub
End Module
EJERCICIO NUMERO2
Module Module1 Sub Main() Dim m(2, 2) As Integer Dim i, j, s, t As Integer For i = 0 To m.GetLength(0) - 1 For j = 0 To m.GetLength(0) - 1 Console.Write("ingrese elemento({0},{1}):", (i + 1), (j + 1)) m(i, j) = Convert.ToInt16(Console.ReadLine()) Next Console.WriteLine("---------------------------------------") Next Console.WriteLine() Console.WriteLine() For i = 0 To m.GetLength(0) - 1 For j = 0 To m.GetLength(0) - 1 Console.Write("{0}", m(i, j)) Next Console.WriteLine() Next For i = 0 To m.GetLength(0) - 1 For j = 0 To m.GetLength(0) - 1 If i = j Then s = m(i, j) End If Next t += s Next