' Numbers that divide the original number exactly
Imports System
Public Class AClass
Public Shared Sub PrintFactors(n As Integer)
For i As Integer = 1 To n
If n Mod i = 0 Then
Console.Write(i & " ")
End If
Next
End Sub
Public Shared Sub Main(ByVal args As String())
Dim n As Integer = 100
PrintFactors(n)
Console.WriteLine()
PrintFactors(24)
End Sub
End Class
' run:
'
' 1 2 4 5 10 20 25 50 100
' 1 2 3 4 6 8 12 24
'