Ayuda con función
Publicado por Elena (1 intervención) el 23/03/2004 18:41:54
Hola no se nada de vb, soy programadora en delphi y estoy tratando de hacer una función en visual basic que me diga si un número es primo o no... Tengo lo siguiente, pero me da error. AYUDENME PLEASE
Function EsPrimo(numero As Integer) As Boolean
Dim x As Integer
Dim maxX As Integer
Result = True
maxX = i - 1
For x = 2 To maxX
If i Mod x = 0 Then
Result = False
Break
End If
Private Sub CommandButton1_Click()
if EsPrimo (TextBox1.Text) = true then
Showmessage(Es un numero primo)
De antemano gracias...
End Sub
Function EsPrimo(numero As Integer) As Boolean
Dim x As Integer
Dim maxX As Integer
Result = True
maxX = i - 1
For x = 2 To maxX
If i Mod x = 0 Then
Result = False
Break
End If
Private Sub CommandButton1_Click()
if EsPrimo (TextBox1.Text) = true then
Showmessage(Es un numero primo)
De antemano gracias...
End Sub
Valora esta pregunta


0