Algoritmos y programacion

Solo disponible en BuenasTareas
  • Páginas : 4 (974 palabras )
  • Descarga(s) : 0
  • Publicado : 23 de mayo de 2011
Leer documento completo
Vista previa del texto
Punto 1
Sub Main()
Dim num(49) As Integer
Dim acum As Integer
Dim promedio As Integer
Dim contador As Integer
For i = 0 To 49
acum = acum +num(i)
Next
promedio = acum / 50
Console.WriteLine("El promedio es: " + promedio)
Console.WriteLine("Valores mayores que el promedio")
For i = 0 To 49If num(i) > promedio Then
contador = contador + 1
Console.WriteLine(num(i))
End If
Next
Console.WriteLine("El numero devalores mayores que el promedio es: " + contador)
End Sub
Punto 2
Sub Main()
Dim A(44) As Integer
Dim B(44) As Integer
Dim C(44) As Integer

For i = 0 To 44Console.WriteLine("Inserte valor para A")
A(i) = Console.ReadLine
Console.WriteLine("Inserte valor para B")
B(i) = Console.ReadLine
C(i) =A(i) + B(i)
Next

For i = 0 To 44
Console.WriteLine(C(i))
Next
End Sub
Punto 3
Sub Main()

Dim A(19) As Integer
Dim mayor As IntegerDim posicion As Integer

For i = 0 To 19
Console.WriteLine("Inserte valor para A")
A(i) = Console.ReadLine
Next
mayor = A(0)
Fori = 1 To 19

If A(i) > mayor Then
mayor = A(i)
posicion = i
End If

Next
Console.WriteLine("El mayor valor es " + mayor+ " en la posición " + posicion)

End Sub
Punto 4
Sub Main()
Dim A(49) As Integer
Dim B(49) As Integer

For i = 0 To 49
Console.WriteLine("Insertevalor para A")
A(i) = Console.ReadLine
B(i) = A(i) * A(i)
Next
Console.WriteLine("Original")
For i = 0 To 49
Console.WriteLine(B(i))...
tracking img