Dim sayı, kont As Long
Private Sub Command1_Click()
sayı = Val(Text1)
If sayı = 1 Then
MsgBox "asal sayı değil "
GoTo son
End If
If (sayı = 2) Or (sayı = 3) Or (sayı = 5) Or (sayı = 7) Then
MsgBox "asal sayı"
GoTo son
End If
If sayı Mod 2 = 0 Then kont = 1
If sayı Mod 3 = 0 Then kont = 1
If sayı Mod 5 = 0 Then kont = 1
If sayı Mod 7 = 0 Then kont = 1
If kont = 1 Then
MsgBox "asal sayı degil"
Else
MsgBox "asal sayı"
End If
son:
Text1 = ""
Text1.SetFocus
kont = 0
End Sub
Private Sub Command1_Click()
sayı = Val(Text1)
If sayı = 1 Then
MsgBox "asal sayı değil "
GoTo son
End If
If (sayı = 2) Or (sayı = 3) Or (sayı = 5) Or (sayı = 7) Then
MsgBox "asal sayı"
GoTo son
End If
If sayı Mod 2 = 0 Then kont = 1
If sayı Mod 3 = 0 Then kont = 1
If sayı Mod 5 = 0 Then kont = 1
If sayı Mod 7 = 0 Then kont = 1
If kont = 1 Then
MsgBox "asal sayı degil"
Else
MsgBox "asal sayı"
End If
son:
Text1 = ""
Text1.SetFocus
kont = 0
End Sub
0 yorum:
Yorum Gönder