Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Sub TALLER_6_UNI_2_punto_1()
Dim n As Integer
Dim v As Integer
n = Val(mensaje)
For n = 1 To n Step 1
v = n
Hoja1.Cells(n, 1) = v
Next n
End Sub
Sub TALLER_6_UNI_2_punto_2()
Dim n As Integer
Dim v As Integer
n = Val(mensaje)
For n = 2 To n Step 2
v = n
Hoja1.Cells(n, 2) = v
Next n
End Sub
Sub TALLER_6_UNI_2_punto_3()
Dim n As Integer
Dim mensaje As String
Dim v As Integer
mensaje = InputBox("Dime un numero", "Ejercicio 3")
n = Val(mensaje)
suma = 0
For n = 1 To n Step 1
suma = suma + n
'Hoja1.Cells(n, 3) = suma
Next n
promedio = suma / (n - 1)
Hoja1.Cells(1, 3) = suma
End Sub
Sub TALLER_6_UNI_2_punto_4()
Dim n As Integer
Dim mensaje As String
Módulo1 - 2
Dim v As Integer
mensaje = InputBox("Dime un numero", "Ejercicio 4")
n = Val(mensaje)
suma = 0
For n = 1 To n Step 1
suma = suma + n
'Hoja1.Cells(n, 1) = suma
Next n
promedio = suma / (n - 1)
Hoja1.Cells(1, 4) = suma
Hoja1.Cells(1, 4) = n
Hoja1.Cells(1, 4) = promedio
End Sub
Sub TALLER_6_UNI_2_punto_5()
x = 0
For i = 2 To n - 1
If n Mod i - 0 Then
x = 1
End If
Next i
If x = 0 Then
MsgBox "el numero es primo"
Else
MsgBox "el numero NO es primo"
End If
End Sub
Sub TALLER_6_UNI_2_punto_6()
Dim n, factorial As Long
factorial = 1
mensaje = InputBox("Dime un numero", "Ejercicio 6")
n = Val(mensaje)
If n < 0 Then
MsgBox "NO tiene factorial"
Else
Do While n > 1
factorial = factorial * n
n = n - 1
Loop
Cells(1, 6) = factorial
End If
End Sub
Sub TALLER_6_UNI_2_punto_7()
For i = 1 To tamaño
If Mid(palabra, i, 1) = "a" Then
contar = contar + 1
End If
Módulo1 - 3
Next
End Sub
Sub TALLER_6_UNI_2_punto_8()
For i = 1 To tamaño
If Mid(palabra, i, 1) = "b" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "c" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "d" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "f" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "g" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "h" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "j" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "k" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "l" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "m" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "n" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "ñ" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "p" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "q" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "r" Then
Módulo1 - 4
contar = contar + 1
End If
If Mid(palabra, i, 1) = "s" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "t" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "v" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "w" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "x" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "y" Then
contar = contar + 1
End If
If Mid(palabra, i, 1) = "z" Then
contar = contar + 1
End If
Next
End Sub
Sub TALLER_6_UNI_2_punto_9()
counter = -1
counter = counter + 1
Else
MsgBox ("El caracter " & number_vector(iRw) & " no es un numero o esta vacio")
End If
Next iRw
max_number = -9999
Position = -1
vector_int = CInt(number_vector(iRw))
max_number = vector_int
Position = iRw
End If
Módulo1 - 5
End If
Next iRw
MsgBox ("El mayor numero esta en la posicion " & CStr(Position + 1) & " con el valor " & CStr(m
ax_number))
End If
Else
End If
End Sub
Sub TALLER_6_UNI_2_punto_10()
desired_length = 9
counter = -1
counter = counter + 1
Else
MsgBox ("El caracter " & number_vector(iRw) & " no es un numero o esta vacio")
End If
Next iRw
max_number = -9999
Position = -1
vector_int = CInt(number_vector(iRw))
max_number = vector_int
Position = iRw
End If
End If
Next iRw
MsgBox ("El mayor numero esta en la posicion " & CStr(Position + 1) & " con el valor "
& CStr(max_number))
End If
Módulo1 - 6
Else
End If
End Sub
Sub TALLER_6_UNI_2_punto_11()
desired_length = 9
counter = -1
counter = counter + 1
Else
MsgBox ("El caracter " & number_vector(iRw) & " no es un numero o esta vacio")
End If
Next iRw
suma = 0
vector_int = CInt(number_vector(iRw))
End If
End If
Next iRw
MsgBox ("La suma de los numeros pares es: " & CStr(suma))
End If
Else
End If
End Sub
Sub TALLER_6_UNI_2_punto_12()
desired_length = 9
Módulo1 - 7
counter = -1
counter = counter + 1
Else
MsgBox ("El caracter " & number_vector(iRw) & " no es un numero o esta vacio")
End If
Next iRw
suma = 0
vector_int = CInt(number_vector(iRw))
End If
End If
Next iRw
MsgBox ("La suma de los numeros inpares es: " & CStr(suma))
End If
Else
End If
End Sub