shd'nt print a line where cnt cnt2? - TechRepublic
General discussion
August 6, 2006 at 05:51 AM
vkaapai

shd’nt print a line where cnt <> cnt2?

by vkaapai . Updated 19 years, 11 months ago

a line where cnt <> cnt2 shldn’t print
Private Sub Command1_Click()
i = InputBox(“PPP”)
cnt = 0
cnt2 = 1

For j = 2 To i
cnt = 0

For k = 2 To j
m = 0
For l = 2 To k
If k Mod l = 0 Then
m = m + 1
End If
Next l
restartline:
If m = 1 Then
cnt = cnt + 1

Print k; “( cnt=”; cnt; “)”; “( cnt2=”; cnt2; “)”;
‘ Print
End If

Next k
‘Print
Print
cnt2 = cnt2 + 1

Next j

End Sub

This discussion is locked

All Comments