Minggu, 27 Juni 2010

MENENTUKAN BILANGAN PRIMA

Private Sub Command1_Click()
For i = 2 To Text1.Text - 1
If Text1.Text Mod i = 0 Then
Text2.Text = "BUKAN BILANGAN PRIMA"
Exit For
Else
Text2.Text = "BILANGAN PRIMA"
End If
Next i

If Text1.Text = "" Then
End If

Command1.Enabled = False
Command2.Enabled = True
Command2.SetFocus
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Command2.Enabled = False
Command1.Enabled = True
End Sub

Private Sub Command3_Click()
End
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

Tidak ada komentar:

Posting Komentar