Answer to Question #13768 in Visual Basic for with

Question #13768
Write a predicate to find the two prime numbers that sum up to a given even integer.
Example:
Input: 28
Output: 5
1
Expert's answer
2012-08-30T09:54:21-0400
Private Delegate Sub numManip()

Sub Main()
Dim evennumber As numManip
Dim allNumbers As [Delegate]
evennumber = New numManip(AddressOf Even)
allNumbers = [Delegate].Combine(evennumber)
allNumbers.DynamicInvoke()
End Sub

Sub Even()
Console.Clear()
Dim counter As Integer = 2
Console.WriteLine("Even Numbers")
Console.WriteLine("Please Enter the Number you Wish to End at: ")
Dim number As Integer = Console.ReadLine()
Console.Clear()
Console.WriteLine("All Even Numbers From 6 to " & number)
Do Until counter > number
Console.WriteLine(counter)
counter += 2
Loop
Console.WriteLine("Press Enter to Continue...")
Console.ReadLine()
End Sub

Public Enum Numbers
Unset
Prime
Composite
End Enum

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS