The while loop, prime numbers
Hello.
I do not know how to finish this code is on display prime number after entering the initial and final value. Attached is a photo of my form.Please help.
Hello.
I do not know how to finish this code is on display prime number after entering the initial and final value. Attached is a photo of my form.Please help.
Code:
Dim x, k, kk, i As Integer
x = txt1
k = txt2
If Not IsNumeric(x) Then
MsgBox "Non-numeric value", vbOKOnly, "Error"
Exit Sub
End If
If Not IsNumeric(k) Then
MsgBox "Non-numeric value", vbOKOnly, "Error"
Exit Sub
End If
If x > k Then
kk = x
x = k
k = kk
ElseIf x = k Then
MsgBox "Too small range", vbOKOnly, "Error"
Exit Sub
End If
While k > x
x = k
Attachments
Last edited: