Contoh program untuk mencari bilangan prima dengan visual basic 6.0.
Script Code:
Dim x, y As Integer
Private Sub cmdBersih_Click()
List1.Clear
txtCari.Text = “”
txtCari.SetFocus
End Sub
Private Sub cmdCari_Click()
batas = Val(txtCari.Text)
For x = 2 To batas
z = 0
For y = 2 To x
hasil = x Mod y
If hasil = 0 Then
z = z + 1
End If
Next y
If z <= 1 Then
List1.AddItem x
End If
Next x
End Sub
Private Sub cmdKeluar_Click()
Unload Me
End Sub
Download programnya di sini
http://www.4shared.com/file/yt8rT4eg/_2__Program_Menampilkan_Bilang.htmlSource : http://oktava.blogdetik.com/
No comments:
Post a Comment