6. Private Sub Command1_Click()
'El algoritmo calcula cuantos números pares e impares de N números ingresados'
Dim i, N, contp, conti As Integer
Dim numero As Double
N = Val(Text1.Text)
i = 1
contp = 0
conti = 0
While i <= N
numero = Val(InputBox("ingrese el numero", "numero"))
If numero Mod 2 = 0 Then
'es numero par
contp = contp + 1
Else
'es impar'
conti = conti + 1
End If
i = i + 1
Wend
Label5.Caption = contp
Label6.Caption = conti
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Label5.Caption = ""
Label6.Caption = ""
Text1.SetFocus
End Sub
10. Private Sub Command1_Click()
'El algoritmo calcula cuál es el número Mayor de N números ingresados por teclado'
Dim i As Integer
Dim mayor, numero As Double
Dim N As Integer
mayor = 0
i = 1
N = Val(Text1.Text)
While i <= N
numero = Val(InputBox("Ingrese numero:", "numero"))
If numero > mayor Then
mayor = numero
End If
i = i + 1
Wend
Label4.Caption = mayor
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Label4.Caption = ""
Text1.SetFocus
End Sub
14. Private Sub Command1_Click()
'El algoritmo calcula la suma y el promedio de N números ingresados por teclado'
Dim i As Integer
Dim suma, promedio, numero As Double
Dim N As Integer
i = 1
N = Val(Text1.Text)
suma = 0
While i <= N
numero = Val(InputBox("Ingrese numero:", "numero"))
suma = suma + numero
i = i + 1
Wend
promedio = suma / N
Label5.Caption = suma
Label6.Caption = promedio
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Label5.Caption = ""
Label6.Caption = ""
Text1.SetFocus
End Sub
18. Private Sub Command1_Click()
Dim i As Integer
Dim numero, rango1, rango2, rango3, fuera As Double
Dim N As Integer
conta = 0
contb = 0
contc = 0
contd = 0
i = 1
N = Val(Text1.Text)
While i <= N
numero = Val(InputBox("Ingrese numero:", "numero"))
If numero >= 15 And numero <= 25 Then
conta = conta + 1
ElseIf numero >= 26 And numero <= 35 Then
contb = contb + 1
ElseIf numero >= 36 And numero <= 57 Then
contc = contc + 1
Else
contd = contd + 1
End If
i = i + 1
Wend
Label7.Caption = conta
Label8.Caption = contb
Label9.Caption = contc
Label10.Caption = contd
End Sub
Private Sub Command2_Click()
If MsgBox("Desea Salir de la Aplicación", vbQuestion + vbYesNo, "Pregunta") Then
End
End If
End Sub
22. Private Sub Command1_Click()
Dim i As Integer
Dim numero As Double
Dim N As Integer
conta = 0
contb = 0
contc = 0
i = 1
N = Val(Text1.Text)
While i <= N
numero = Val(InputBox("Ingrese numero:", "numero"))
If numero >= 7 Then
conta = conta + 1
ElseIf numero <= 7 Then
contb = contb + 1
ElseIf numero = 7 Then
contc = contc + 1
End If
i = i + 1
Wend
Label5.Caption = conta
Label6.Caption = contb
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Label5.Caption = ""
Label6.Caption = ""
Text1.SetFocus
End Sub