English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I can not figure out how to find the prime numbers given to inputs. (For examply 1 and 100, I would want to find all primes between those numbers)

Here is what I have thus far:

Dim countShort As Short
Dim number1Short As Short
Dim nuber2Short as Short
Dim largeNumberShort As Short
Dim smallNumberShort As Short
Dim countShort As Short

number1Short = number1Textbox.Text
number2Short = number2Textbox.Text

If number1Short < number2Short Then
number1Short = smallNumberShort
number2Short = largeNumberShort
Else
number1Short = largeNumberShort
number2Short = smallNumberShort
End If

So that basically only finds wich number is larger, just in case the user enters the bigger number first.

2007-03-18 15:17:41 · 2 answers · asked by Justin 4 in Computers & Internet Programming & Design

Neither of the two following answers helped.

2007-03-18 15:44:44 · update #1

2 answers

Hi there.

I could give you the coding but that defeats the purpose of coming up of one yourself, and learning as you develop the formulae and alogorithm.

Here's a site that explains how it works with a few code snippets. You'll have to modify it to suit your needs.

http://www.xtremecomp.com/tips/xttip19.htm

Hope this helps

2007-03-18 15:33:38 · answer #1 · answered by iskai 4 · 0 0

all primes 1-100:
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
71, 73, 79, 83, 89, 97

make sure you Val() the text boxes...

2007-03-18 22:25:59 · answer #2 · answered by spl 4 · 0 0

fedest.com, questions and answers