You are on page 1of 1

Dim n, u, d, c, i, j, cp As Integer

Me.lstnum.Items.Clear()
If Me.txtvi.Text = "" Or Me.txtvf.Text = "" Then
MsgBox("Ingrese un n�mero de 3 cifras")
If Me.txtvi.Text = "" Then
Me.txtvi.Focus()
Else
Me.txtvf.Focus()
End If
ElseIf Val(Me.txtvf.Text) < Val(Me.txtvi.Text) Then
MsgBox("El N�mero final es menor que el N�mero inicial")
Me.txtvf.Focus()
ElseIf Val(Me.txtvi.Text) < 100 Or Val(Me.txtvf.Text) < 100 Then
MsgBox("Ingrese N�mero de 3 cifras")
If Me.txtvi.Text < 100 Then
Me.txtvi.Clear()
Me.txtvi.Focus()
Else
Me.txtvf.Focus()
Me.txtvf.Focus()
End If
Else
vi = Val(Me.txtvi.Text)
vf = Val(Me.txtvf.Text)
If Me.rbtcapi.Checked = True Then
For i = vi To vf
n = i
u = (n Mod 10)
d = (n \ 10) Mod 10
c = (n \ 100)
If u = c Then
Me.lstnum.Items.Add(" " & n)
End If
Next
Me.lblcant.Text = Me.lstnum.Items.Count
ElseIf Me.rbtpri.Checked = True Then
For i = vi To vf
cp = 0
n = i
For j = 1 To n
If n Mod j = 0 Then
cp = cp + 1
End If
Next
If cp < 3 Then
Me.lstnum.Items.Add(" " & n)
End If
Next
Me.lblcant.Text = Me.lstnum.Items.Count
Else
MsgBox("Seleccione una operaci�n")
Me.rbtcapi.Focus()
End If
End If

You might also like