Module Module1 Sub Main() 'Program to generate prime numbers 'declaring the variables Dim num, count, inner_index, index As Integer Console.WriteLine("Enter number to generate prime number to that range (e.g. 10,20,50 etc.)") num = Console.ReadLine() Console.WriteLine("The prime numbers are") For index = 1 To num count = 0 For inner_index = 1 To index If index Mod inner_index = 0 Then count = count + 1 End If Next If count = 2 Then Console.Write(index & " ") End If Next Console.ReadKey() End Sub End Module
Comments
Post a Comment