Está en la página 1de 8

Pregunta uno

Private Sub cmdcalcular_Click()


Dim n As Integer
n = Val(txtn.Text)
If n > 0 Then
txtr.Text = "positivo"
ElseIf n < 0 Then
txtr.Text = "negativo"
Else
txtr.Text = "cero"
End If
End Sub

Pregunta dos
Private Sub cmdcalcular_Click()
Dim n As Integer
Dim a As Integer
n = Val(txtn.Text)
If n <> o Then
If n Mod 2 = 0 Then
txta.Text = 6 * n ^ 2
End If
Else
MsgBox ("error")
End If
End Sub

Pregunta tres

Private Sub cmdcalcular_Click()


Dim l1 As Integer
Dim l2 As Integer
Dim l3 As Integer
Dim t As Integer
l1 = Val(txtl1.Text)
l2 = Val(txtl2.Text)
l3 = Val(txtl3.Text)
mayor = l1
If l2 > mayor Then
End If
mayor = l2
If l3 > mayor Then
mayor = l3
End If
suma = l1 + l2 + l2 - mayor
If mayor < suma Then
If l1 = l2 And l2 = l3 Then
txtt.Text = "equilatero"
ElseIf l1 = l2 Or l1 = l3 Or l2 = l3 Then
txtt.Text = "isosceles"
Else
txtT.Text = "escaleno"
End If
Else
MsgBox "NO SE PUEDE FORMAR EL TRIANGULO"
End If
End Sub

Pregunta cuatro
Private Sub cmdingresar_Click()
Dim n As Integer
Dim s As Integer
List1.AddItem txtn.Text
txtn.Text = Empty
txtn.SetFocus

End Sub
Private Sub cmdcalcular_Click()
Dim n As Integer
Dim s As Integer
Dim i As Integer
For i = 0 To List1.ListCount - 1

n = Val(List1.List(i))
If n Mod 2 <> o Then
s=s+n
End If
Next i
txts.Text = s
End Sub

Ejercicos 5
Private Sub cmdcalcular_Click()
Dim n As Integer
Dim r As Integer
Dim i As Integer

Dim s As Integer
n = Val(txtn.Text)
For i = 1 To n - 1
If n Mod i = 0 Then
s=s+i
End If
Next i
If s = n Then
txtr.Text = "perfecto"
Else
txtr.Text = "no es perfecto"
End If
End Sub

Ejercicios 6
Private Sub cmdcalcular_Click()
Dim n As Integer
Dim r As Integer
Dim inv As Integer
n = Val(txtn.Text)
If n > 9 Then
While n <> o
r = n Mod 10
inv = inv * 10 + r
n = n \10
Wend
txtr.Text = inv
End If

End Sub

Ejercico 7
Private Sub cmdcalcular_Click()
Dim n As Integer
Dim p As Integer
Dim ip As Integer
Dim c As Integer
Dim r As Integer
n = Val(txtn.Text)
If n > 99 Then
While n <> 0
r = n Mod 10
If r <> o Then
If r Mod 2 = 0 Then
par = par + 1
Else
ip = ip + 1
End If
Else
c=c+1
End If
n = n / 10
Wend
txtp.Text = par
txtip.Text = ip
txtc.Text = c
End If

End Sub

Esto es la codificacin de mdi


Private Sub MDIForm_MouseDown(Button As Integer, Shift As Integer,
X As Single, Y As Single)
If Button = 2 Then
PopupMenu MNUPROGRAMAS
End If
End Sub
Private Sub mnupro1_Click()
Form1.Show
End Sub
Private Sub mnupro2_Click()
Form2.Show
End Sub
Private Sub mnupro3_Click()
Form3.Show
End Sub
Private Sub mnupro4_Click()
Form4.Show
End Sub
Private Sub mnupro5_Click()
Form5.Show
End Sub
Private Sub mnupro6_Click()
Form6.Show
End Sub
Private Sub mnupro7_Click()
Form7.Show

End Sub
Private Sub mnusalir_Click()
End
End Sub

Private Sub MNUPROG1_Click()


Form1.Show
End Sub

Private Sub MNUPROG2_Click()


Form2.Show
End Sub

Private Sub MNUPROG3_Click()


Form3.Show
End Sub

Private Sub MNUPROG4_Click()


Form4.Show
End Sub

Private Sub MNUPROG5_Click()


Form5.Show
End Sub

Private Sub MNUPROG6_Click()


Form6.Show
End Sub

Private Sub MNUPROG7_Click()


Form7.Show
End Sub