Compu
Compu
End Sub
MsgBox ("Hola Como Estas " & nombre) ' se muestra un saludo
End Sub
End Sub
4. Private Sub Command1_Click()
End Sub
area = l * l
End Sub
6. Private Sub Command1_Click()
area = (b * a) / 2
MsgBox ("el area del triangulo rectangulo es: " & area)
End Sub
area = (b * a) / 2
MsgBox ("el area del triangulo rectangulo es: " & area)
End Sub
Dim a, b As Integer
a = Val(Text1.Text)
b = Val(Text2.Text)
End Sub
Dim c, f As Integer
c = Val(Text1.Text)
f = (9 / 5) * c + 32
Text2.Text = f
End Sub
a = Val(Text1.Text)
b = Val(Text2.Text)
c = Val(Text3.Text)
Label4.Caption = (a + b + c) / 3
End Sub
nht = Val(Text1.Text)
pxh = Val(Text2.Text)
End Sub
n1 = Val(txtNum1.Text)
n2 = Val(txtNum2.Text)
lblOp.Caption = "+"
txtRes.Text = n1 + n2
End Sub
n1 = Val(txtNum1.Text)
n2 = Val(txtNum2.Text)
lblOp.Caption = "-"
txtRes.Text = n1 - n2
End Sub
n1 = Val(txtNum1.Text)
n2 = Val(txtNum2.Text)
lblOp.Caption = "*"
txtRes.Text = n1 * n2
End Sub
n1 = Val(txtNum1.Text)
n2 = Val(txtNum2.Text)
lblOp.Caption = "/"
txtRes.Text = n1 / n2
End Sub
cf = Val(Text1.Text)
cv = Val(Text2.Text)
q = Val(Text3.Text)
ct = cf + cv * q
Text4.Text = ct
End Sub
c = Val(Text1.Text)
cv = Val(Text2.Text)
pf = c + cv + (c * iva)
Text4.Text = pf
End Sub
SELECTIVAS
If (num = 0) Then
MsgBox (num & " es cero")
Else
End If
End Sub
Else
End If
End Sub
Else
End If
End Sub
Else
End If
End Sub
If (a > b) Then
Else
End If
End Sub
Dim a, b As Integer
If (a < b) Then
Else
End If
End Sub
22. Private Sub Command1_Click()
Dim a, b As Integer
a = Val(Text1.Text)
b = Val(Text2.Text)
If (a = b) Then
Else
If (a > b) Then
Else
End If
End If
End Sub
n1 = Val(Text1.Text)
n2 = Val(Text2.Text)
n3 = Val(Text3.Text)
MsgBox (n1 & " " & n2 & " " & n3)
Else
MsgBox (n1 & " " & n3 & " " & n2)
End If
End If
MsgBox (n2 & " " & n1 & " " & n3)
Else
MsgBox (n2 & " " & n3 & " " & n1)
End If
End If
MsgBox (n3 & " " & n1 & " " & n2)
Else
MsgBox (n3 & " " & n2 & " " & n1)
End If
End If
End Sub
24. Private Sub cmdInicio_Click()
MsgBox ("Aprobado")
Else
MsgBox ("Reprobado")
End If
Else
End If
End Sub
n1 = Val(Text1.Text)
If (n1 >= 10 And n1 <= 50) Then
Else
Else
Else
End If
End If
End If
End Sub
n1 = Val(Text1.Text)
Else
If (n1 >= 51 And n1 <= 79) Then
Else
Else
End If
End If
End If
End Sub
REPETITIVAS
For i = 1 To 10 Step 1
suma = suma * n
n=n+3
Next i
MsgBox ("la suma de los 10 primeros multiplos de 3: " & f)
End Sub
End Sub
Next i
MsgBox ("el valor de PI es: " & pi * 4)
End Sub
For i = 3 To n Step 1
n=a+b
lstSalida1.AddItem (n)
c=c+1
a=b
b=n
Next i
End Sub
End Sub
For i = 1 To n Step 1
If (n Mod i = 0) Then
cd = cd + 1
End If
Next i
If (cd = 2) Then
primo = True
Else
primo = False
End If
End Function
a = InputBox("Ingrese A")
b = InputBox("Ingrese B")
sma = 0
For i = 1 To a - 1 Step 1
If (a Mod i = 0) Then
sma = sma + i
End If
Next i
smb = 0
For i = 1 To b - 1 Step 1
If (b Mod i = 0) Then
smb = smb + i
End If
Next i
End Sub
End Sub
n = txtNum1.Text
res = perfecto(n)
If (res = True) Then
MsgBox ("Es Numero Perfecto")
Else
MsgBox ("No es Numero Perfecto")
End If
End Sub
Function perfecto(n As Integer) As Boolean
Dim suma As Integer
suma = 0
For i = 1 To n - 1 Step 1
If (n Mod i = 0) Then
suma = suma + i
End If
Next i
If (suma = n) Then
perfecto = True
Else
perfecto = False
End If
End Function
End Sub
Function primo(n As Integer) As Boolean
Dim cd As Integer
For i = 1 To n Step 1
If (n Mod i = 0) Then
cd = cd + 1
End If
Next i
If (cd = 2) Then
primo = True
Else
primo = False
End If
End Function
49.
Private Sub cmdInicio_Click()
Dim n1 As Integer
Dim n2 As Integer
Dim pm As Double
Dim cont As Integer
Dim v1 As Boolean
Dim sm As Integer
Dim pmdt As Double
VECTORES
50. Dim vec(1 To 10) As Integer
Private Sub cmdBuscar_Click()
numB = txtElemBuscar.Text
pos = -1
For i = 1 To 10 Step 1
If (vec(i) = numB) Then
pos = i
End If
Next
For i = 1 To 10 Step 1
For j = i To 10 - 1 Step 1
If (vec(i) > vec(j + 1)) Then
aux = vec(i)
vec(i) = vec(j + 1)
vec(j + 1) = aux
End If
Next j
Next i
lstSalida2.Clear
For i = 1 To 10 Step 1
lstSalida2.AddItem (vec(i))
Next i
End Sub
51. Dim vec(1 To 10) As Integer
Private Sub cmdCargarVector_Click()
For i = 1 To 10 Step 1
vec(i) = InputBox("Ingrese un numero")
Next
End Sub
Private Sub cmdMostrar_Click()
For i = 1 To 10 Step 1
lstSalida1.AddItem (vec(i))
Next
End Sub
End Sub
ARCHIVOS
End Sub
57. Dim art(1 To 100) As String
Dim vt(1 To 1000) As String
Dim j As Integer
Dim k As Integer
Dim i As Integer
Dim linea As String
OTROS
58. Private Sub cmdPrimosG_Click()
Dim n1, n2 As Integer
Dim res As Boolean
n1 = txtNum1.Text
n2 = txtNum2.Text
MsgBox (n1 & " " & n2)
res = PrimosGemelos(n1, n2)
MsgBox (res)
If (res = True) Then
MsgBox ("Son Primos gemelos")
Else
MsgBox ("No son Primos gemelos")
End If
End Sub
For i = 1 To n Step 1
If (n Mod i = 0) Then
cd = cd + 1
End If
Next i
If (cd = 2) Then
primo = True
Else
primo = False
End If
End Function
cad = txtCadena.Text
cb = InputBox("ingrese la cadena a Buscar")
pos = InStr(cad, cb)
MsgBox ("la sub cadena inicia en: " & pos)
End Sub
End Sub
cad = txtCadena.Text
End Sub
Dim i As Integer
i=1
lstSalida1.Clear
lstSalida1.AddItem (alumnos(i))
i=i+1
Wend
Close #2
End Sub
For i = 1 To 5 Step 1
Next i
Close #1
End Sub
62. Dim pals(1 To 150) As String
Next i
txtGerigoncio.Text = geri
End Sub
Dim np As String
Dim c As String
c = Left(pal, 1)
Else
np = np & c
End If
Wend
convGeri = np
End Function
lstsalida2.Clear
lstsalida2.AddItem (pals(i))
End If
Next i
End Sub
cantidad = cantidad + 1
End If
End If
Next i
MsgBox ("la cantidad de caracteres numericos es :" & cantidad)
End Sub
men = pals(1)
men = pals(i)
End If
Next i
MsgBox ("la palabra de mayor longitus es :" & men & " tam: " & Len(men))
End Sub
may = pals(1)
may = pals(i)
End If
Next i
MsgBox ("la palabra de mayor longitus es :" & may & " tam: " & Len(may))
End Sub
lstSalida1.Clear
lstSalida1.AddItem (pals(i))
Next i
Else
End If
End Sub
Dim p1 As Integer
cont = 0
While (InStr(cad, " ") <> 0) 'mientra exista un siguiente espacio en la cadena
Wend
Dim i As Integer
i=1
cadena = txtCadena.Text
cadAux = cadena
lstSalida1.Clear
i=i+1
pal = NextPal(cadAux)
cadAux = DelPal(cadAux)
Else
pal = cadAux
End If
pals(i) = pal
lstSalida1.AddItem (pal)
Wend
End Sub
Dim p As Integer
res = Left(cadena, p - 1)
NextPal = res
End Function
Dim p As Integer
tam = Len(cadena)
DelPal = res
End Function
63. Dim c(1 To 100) As String
Dim i As Integer
Dim j As Integer
Dim k As Integer
k=0
lstSalida2.Clear
k=k+1
a(k) = linea
lstSalida2.AddItem (a(k))
Wend
Close #2
End Sub
Dim m As Integer
lstSalida3.Clear
For i = 1 To j Step 1
nom = nombre(c(i))
nota1 = nota(c(i))
For m = 1 To k Step 1
nom1 = nombre(a(m))
nota2 = nota(a(m))
lstSalida3.AddItem (nom)
End If
End If
Next m
Next i
Close #3
End Sub
tam = Len(cadena)
res = Left(cadena, p2 - 1)
nombre = res
End Function
tam = Len(cadena)
nota = res
End Function
j=0
lstSalida1.Clear
j=j+1
c(j) = linea
lstSalida1.AddItem (c(j))
Wend
Close #1
End Sub
64. Private Sub cmdMostrar_Click()
i=0
lstSalida1.Clear
i=i+1
lstSalida1.AddItem (docentes(i))
Wend
Close #1
End Sub
contTD = 0
For i = 1 To nr Step 1
contTD = contTD + 1
End If
Next i
contTA = 0
For i = 1 To nr Step 1
contTA = contTA + 1
End If
Next i
MsgBox ("son " & contTD & " con titulo en Lic. Derecho")
MsgBox ("son " & contTA & " con titulo en Lic. Auditoria")
End Sub
j=0
lstSalida1.Clear
j=j+1
ent(j) = linea
lstSalida1.AddItem (ent(j))
Wend
Close #1
End Sub
aux = ent(i)
ent(i) = ent(j + 1)
ent(j + 1) = aux
End If
Next j
Next i
lstSalida4.Clear
For i = 1 To 5 Step 1
cad = ent(i)
lstSalida4.AddItem (cad)
Next i
End Sub
lstSalida2.Clear
cad = ent(i)
tit = titulo(cad)
lstSalida2.AddItem (tit)
Next i
End Sub
titulo = pal
End Function