It must be a FAQ. I've answered this one before. And the link shown below gives another time, too. Should make a Wiki on it.
Module vbconsole
Delegate Function isvalid(Of T)(element As T) As Boolean
Delegate Function createlist(Of T)(count As Integer) As List(Of T)
Function factor(n As Integer) As Integer
Dim q As Integer, sqrtn As Integer
If n < 2 Then Return n - 1
If n = 3 Then Return n
If n Mod 2 = 0 Then Return 2
sqrtn = CInt(System.Math.Sqrt(n))
For q = 3 To sqrtn Step 2
If n Mod q = 0 Then Return q
Next
Return n
End Function
Sub PrintList(Of T)(elements As List(Of T), printtest As isvalid(Of T))
For Each p As T In elements
If printtest(p) Then
Console.Write(" {0}", p)
End If
Next
Console.WriteLine("")
End Sub
Sub Main()
Dim intlist As createlist(Of Integer) = Function(count As Integer) As List(Of Integer)
Dim i As Integer
Dim a As New List(Of Integer)
For i = 0 To count - 1
a.Add(i + 1)
Next
Return a
End Function
Console.Write("Enter N: ")
Dim response As String = Console.ReadLine()
Dim N As Integer = Val(response)
Console.WriteLine("Odd numbers:")
PrintList(intlist(N), Function(a) a Mod 2 = 1)
Console.WriteLine("Even numbers:")
PrintList(intlist(N), Function(a) a Mod 2 = 0)
Console.WriteLine("Prime numbers:")
PrintList(intlist(N), Function(a) factor(a) = a)
Console.WriteLine("Numbers divisible by 4:")
PrintList(intlist(N), Function(a) a Mod 4 = 0)
End Sub
End Module
EDIT: The calculations of even, odd, and divisible by 4 are obvious to grade school students, so you couldn't possibly have been asking about that. Leaving prime numbers. And googling makes that trivial, too -- a waste asking here. So that leaves delegates as the only reasonable question you could be asking. But C doesn't have delegates. So no C, sorry.