You are on page 1of 1

ORDENADO E INVERTIDO 9. INVERTIR CADA NUMERO INGRESADO 7. NUMEROS PERFECTOS 10.

SUMATORIA DE CADA NUMERO 8, MULTIPLOS DE 5


Option Base 1 Option Base 1 Dim n As Integer, i As Integer, a() As Integer Dim a() As Integer, n As Integer, i As Integer, b() Dim a() As Integer, n As Integer, i As
Dim a() As Integer, i As Integer, n As Integer, j Dim a() As Double, b() As Double, i As Integer, j As Integer, n As Private Sub cmdinicializar_Click() As Integer
As Integer, aux As Integer n = Val(txtn) Private Sub Command1_Click()
Integer
Double, inv As Double
Private Sub cmdingresado_Click() Private Sub cmdimprimir_Click() If IsNumeric(txtn.Text) Then n = Val(txtn) Private Sub inicializar_Click()
txt1 = " " TXTIMPRIMIR = "" If n >= 1 Then If IsNumeric(txtn.Text) Then n = Val(txtn)
For i = 1 To n For i = 1 To n ReDim a(n) If n >= 0 Then If IsNumeric(txtn.Text) Then
txt1.SelText = a(i) TXTIMPRIMIR.SelText = a(i) & " " & vbCrLf For i = 1 To n ReDim a(n) If n >= 1 Then
Next i Next i a(i) = Val(InputBox("Ingrese valor " & i)) For i = 1 To n
End Sub Next i a(i) = Val(InputBox("Ingrese valor " & i))
ReDim a(n)
End Sub
Private Sub cmdinicializar_Click() Private Sub cmdiniciar_Click() Else Next i For i = 1 To n
n = Val(InputBox("ingrese el tamaño del n = Val(txtn) MsgBox ("El valor no es numerico") Else a(i) = Val(InputBox("Ingrese valor
vector")) If IsNumeric(txtn.Text) Then End If MsgBox ("El valor es negativo") " & i))
ReDim a(n) If n >= 1 Then Else End If Next i
For i = 1 To n ReDim a(n) MsgBox ("El valor no es numerico") Else
a(i) = (InputBox("ingrese los End If MsgBox ("El valor no es numerico")
Else
For i = 1 To n
elementos del vextor")) a(i) = Val(InputBox("Ingrese numero " & i)) MsgBox ("Arreglo inicializado") End If MsgBox ("El valor es negativo")
Next i Next i End Sub End Sub End If
MsgBox ("arreglo inicializado") Else Private Sub Command1_Click() Private Sub Command2_Click() Else
End Sub MsgBox ("El numero es negativo") Text1 = "" ReDim b(n) MsgBox ("El valor no es numerico")
Private Sub cmdinv_Click() End If For i = 1 To n For i = 1 To n
For i = 1 To n - 1 aux = a(i) aux = a(i) End If
Else
For j = i + 1 To n MsgBox ("El valor no es numerico") If aux <> 0 Then f=0 End Sub
If a(j) < a(i) Then End If dsor = 1 For j = 1 To aux Private Sub Cmdvermultipplo_Click ()
aux = a(i) End Sub m=0 f=f+j txtm = ""
a(i) = a(j) Private Sub cmdinvertidos_Click() For j = 1 To aux / 2 Next j For i = 1 To n
a(j) = aux ReDim b(n) If aux Mod j = 0 Then b(i) = f
End If m=m+j Next i aux = a(i)
txtinvertidos = ""
Next j For i = 1 To n Else MsgBox ("Sumatoria realizada") If aux Mod 5 = 0 Then
Next i b(i) = a(i) End If End Sub aux = " es multiplo de 5"
MsgBox ("vector ordenado") aux = b(i) Next j Else
txtinv = " " inv = 0 If m = aux Then Private Sub Command3_Click() aux = ""
For i = 1 To n While aux <> 0 aux = " es un numero perpecto" txtnormal = ""
txtinv.SelText = a(i) Else txts = "" End If
inv = inv * 10 + aux Mod 10
Next i aux = aux \ 10 aux = "" For i = 1 To n txtm = txtm & a(i) & aux & vbCrLf
End Sub b(i) = inv End If txtnormal = txtnormal & a(i) & vbCrLf Next i
Wend End If txts = txts & b(i) & vbCrLf End Sub
txtinvertidos.SelText = b(i) & vbCrLf Text1 = Text1 & a(i) & aux & vbCrLf Next i
Next i Next i End Sub
MsgBox ("Arreglo invertido") End Sub
End Sub

4.FACTORIAL DE CADA NUMERO LEIDO 6.N NUMEROS Y DECIR CUALES SON MOSTRAR CUALES SON PARES E IMPARES
Option Base 1 PRIMOS Option Base 1
Dim a() As Integer, i As Integer, fac As Dim a() As Integer, n As Integer, i As Dim a() As Integer, p() As Integer, im() As Integer, i
Integer, n As Integer, f() As Integer, aux Integer, p() As Integer, l() As Integer As Integer, n As Integer, c As Integer, aux As Integer,
As Integer, j As Integer Private Sub cmdinicializar_Click() j As Integer
Private Sub cmdfac_Click() n = Val(txtn) Private Sub cmdinicializar_Click()
txtfac = "" If IsNumeric(txtn.Text) Then n = Val(txtn)
ReDim f(n) If n >= 1 Then If IsNumeric (txtn. Text) Then
For i = 1 To n ReDim a(n) ReDim a(n)
aux = a(i) For i = 1 To n For i = 1 To n
fac = 1 a(i) = Val(InputBox("Ingrese a(i) = Val (Input Box ("ingrese el valor" & i))
For j = 1 To aux valor " & i)) Next i
fac = fac * j Next i Else
Next j Else MsgBox ("el valor no es numerico")
f(i) = fac MsgBox ("El valor no es End If
txtfac.SelText = f(i) & " " & vbCrLf numerico") End Sub
Next i End If Private Sub cmdpar_Click ()
End Sub Else txtp = ""
Private Sub cmdinicializar_Click() MsgBox ("El valor no es numerico") For i = 1 To n
n = Val(txtn) End If aux = a(i)
If IsNumeric(txtn.Text) Then End Sub For j = 1 To n
ReDim a(n) Private Sub cmdver_Click() If aux Mod 2 = 0 Then
For i = 1 To n txtv = "" c=c+1
a(i) = Val(InputBox("ingrese el For i = 1 To n End If
vector" & " " & i)) txtv = txtv & a(i) & vbCrLf Next j
Next i Next i ReDim p(c)
MsgBox ("vector inicializado") End Sub If aux Mod 2 = 0 Then
Else Private Sub Command1_Click() p(i) = aux
MsgBox ("el valor no es numerico") txtp = "" txtp = txtp & p(i) & vbCrLf
End If For i = 1 To n End If
End Sub aux = a(i) Next i
Private Sub cmdvector_Click() m=0 End Sub
txtvector.Text = " " For j = 1 To aux Private Sub cmdverpareseimpares_Click ()
For i = 1 To n If aux Mod j = 0 Then txtimp = ""
txtvector.SelText = a(i) & " " & m=m+1 For i = 1 To n
vbCrLf End If aux = a(i)
Next i Next j For j = 1 To n
End Sub If m = 2 Then If aux Mod 2 <> 0 Then
Private Sub Form_Load() aux = " es primo" c=c+1
MsgBox ("ingrese el tamaño del Else End If
vector") aux = "" Next j
End Sub End If ReDim im(c)
txtp = txtp & a(i) & aux & vbCrLf If aux Mod 2 <> 0 Then
Next i im(i) = aux
End Sub tiempo. SelText = im(i) & vbCrLf
End If
Next
End Sub
Private Sub cmdvervector_Click ()
txtvervector = ""
For i = 1 To n
txtvervector. SelText = a(i) & vbCrLf
Next i
End Sub

You might also like