Programacion en c

Páginas: 5 (1107 palabras) Publicado: 12 de octubre de 2010
Module Module1
Sub Main()
Dim n(4) As Short
Dim elemento, wmax, wsuma, wbusca As Byte
Dim i As Integer
Dim wprom As Single
'//
For i = 0 To 4
Console.Write("Ingrese Elemento {0}: ", (i + 1))
n(i) = Convert.ToInt16(Console.ReadLine)
Next
Console.WriteLine()
'//
wmax = n(0)For Each elemento In n
If elemento > wmax Then
wmax = elemento
End If
Next
Console.WriteLine("Numero Mayor en Lista es = {0}{1}", wmax, vbCrLf)
'//
wsuma = 0
For Each elemento In n
wsuma += elemento
Next
wprom = wsuma / 5
Console.WriteLine("Promedio Numeros es= {0}", wprom)
'//
Console.WriteLine("{0}Ingrese Numero a Buscar: ", vbCrLf)
wbusca = Convert.ToInt16(Console.ReadLine)
For Each elemento In n
If elemento = wbusca Then
Console.WriteLine("{0}---> Numero si Existe ", vbCrLf)
Exit For
Else
Console.WriteLine("{0}---> Numero noExiste ", vbCrLf)
Exit For
End If

Next
'//
Console.WriteLine()
Console.WriteLine("Lista Elementos en Orden Inverso a su Ingreso:")
For i = 4 To 0 Step -1
Console.Write("{0}{1}", n(i), vbTab)
Next
'//
Console.Read()
End Sub
End Module

EJERCICIO NUMERO1
Module Module1Sub 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
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 = 0To 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 Tom.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
NextConsole.WriteLine("la suma d ela diagonal mayor es ={0}", t)
Console.Read()
End Sub
End Module

EJERCICIO NUMERO3
Module Module1
Sub Main()
Dim m(2, 2) As Integer
Dim i, j 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))...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • programacion C
  • Programacion c++
  • c# Programacion
  • Programacion En C#
  • Programacion en c
  • Programacion en c
  • Programacion en c++
  • Programacion c ++

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS