Im new here, read over all the do's and dont's and I believe I can abide by these, so lets give'r a go.
I found this website, and as I am taking a programming course right now, Im hoping I can pick everyones brain to give me a hand as its not my strong suit, but once im steered in the right direction I usually grasp things very quickly.
Im currently working on a homework assignment for my programming class, and Ive come across a part of a question that is making me want to put my head through a wall. Any help would be great. I dont expect the code to fix the problem, but any hints or tips to get me in the right direction would be wonderful.
So, here is the question at hand.
I need my code to take any given number that has been entered, and output all of the PRIME numbers up to and including the number entered.
I have like 200 lines of me trying many different things, and this one seems to be (in my head) the closest I have to a working code.
Module Module1
Sub Main()
Dim i As Integer
Dim x As Integer
Dim num1 As Integer
Dim N As Integer
Dim c As Integer
c = 0
Console.WriteLine("Please enter a number: ")
num1 = Console.ReadLine()
For i = 1 To num1 \ 2
If num1 Mod i = 0 Then c = c + 1 'how do i add to list
Next
Console.WriteLine("Here are the prime numbers up to " & num1)
'For x = 1 To num1.Length - 1
num1 = Integer.Parse(Console.ReadLine)
If x Mod N >= 1 Then
'Exit For
ElseIf x Mod N = 0 Then 'add to list
End If
Console.ReadLine()
Console.ReadLine() 'keeps the window open
End Sub
End Module

New Topic/Question
Reply



MultiQuote






|