Programe to print prime number in visual basic 6.0
Private Sub Form_Load() 'this programm is program to find prime noumbers till '100 'This programe is programmed and coded by 'Safwan patel 'you can share this programm no copyrights MsgBox ("PLease enter any noumber under 100 for finding prime no.") MsgBox ("this programm will find prime noumbers under 100") End Sub Private Sub cmdFind_Click() ' this code is 4 event when user will click this button Dim inti As Integer, intnum As Integer ' data verification related to use intnum = Val(txtnum.Text) ' converts text into number and take it in use List1.AddItem 1 List1.AddItem 2 List1.AddItem 3 List1.AddItem 5 List1.AddItem 7 ' we are adding this abouve itemes in list1 as 'we know already this noumbers are prime 'and also we dont want to waset pc time For inti = 4 To intnum Step 1 If inti Mod 2 = 0 Then 'we are moving all no. which are divisible by 2 List2.AddItem inti Else If inti Mod 3 = 0 Then 'after taking all odd no. 'we are moving all no. which are divisible by 3 List2.AddItem inti Else If inti Mod 5 = 0 Then 'agin we are moving all no. which are divisible by 5 List2.AddItem inti Else If inti Mod 7 = 0 Then ' we are moving all no. which are divisible by 7 List2.AddItem inti Else If inti Mod 9 Then 'agin we are moving all no. which are divisible by 9 List2.AddItem inti Else List1.AddItem inti End If End If End If End If End If Next inti End Subwhen i insert 100 in text bos the result will be :
1 2 3 5 7can any one help me with this i want a programe to print prime noumber till 100
if you dont give code then atleast give me algorithem .😒