DETERMIANR LOS NUMEROS PRIMOS By… William Pilco

Anuncio
DETERMIANR LOS NUMEROS PRIMOS
By…
William Pilco
Silvia Quinatoa
Paul Nuñez
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
End
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim a As Integer
Dim b As Integer = 4
Dim j As Integer = 2
Dim i As Integer
Dim dic As String = ""
a = TextBox1.Text
If (a > 2) Then
dic = "2 - 3"
While (j < a)
i = 2
While (i <= b)
If (i = b) Then
dic = dic + " - " + Trim(b)
j = j + 1
Else
If (b Mod i = 0) Then
i = b
End If
End If
i = i + 1
End While
b = b + 1
End While
TextBox2.Text = dic
Else
If (a > 0) Then
If (a = 1) Then
TextBox2.Text = "es primo 2"
Else
TextBox2.Text = "Es primo 2, 3"
End If
Else
TextBox2.Text = "Ingrese un numero positivo"
End If
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
Descargar