I need to add all the prime numbers below an arbitrary number.

Printable View

- 06-30-2010, 08:04 PMcidNeed help with a program!
I need to add all the prime numbers below an arbitrary number.

- 06-30-2010, 08:13 PMFubarableQuote:

Do you see what I am doing wrong?

- 06-30-2010, 08:23 PMcid
sorry fubarable we have an understanding now

- 06-30-2010, 08:59 PMJosAH
- 06-30-2010, 11:19 PMNormQuote:

I can't use the % option

What is your algorithm for determining if a number is prime? Not the definition, a list of steps to determine it. - 07-01-2010, 12:07 AMcid
yes, it is a requirement. the way i will find out if a number has a remainder is to multiply by two times the divisor and subtract that from the number.

- 07-01-2010, 12:35 AMNorm
So how is the project doing then?

- 07-01-2010, 12:50 AMcid
horribly. man

- 07-01-2010, 12:53 AMNorm
Try debugging your code by printing out each number it tests and show whether that number is prime or not.

- 07-01-2010, 02:06 AMcid
tried debugging

- 07-01-2010, 02:48 AMNorm
Do the following:

Try debugging your code by printing out each number it tests and show whether that number is prime or not.

Where is the answer to this question?

What is your algorithm for determining if a number is prime? - 07-01-2010, 03:10 AMcid
in order to find out if the number is prime using integers i am subtracting the quotient*divisor from the dividend. if the result is >0 in every instance i am trying to make the program understand that the number is prime and to add it to the sum. if the result of dividend-quotient*divisor is 0 then i want the program to skip that number and not add it to the sum.

- 07-01-2010, 03:52 AMNorm
Are you able to understand the following request:

Try debugging your code by printing out each number it tests and show whether that number is prime or not.

Also print out the values of the quotient, divisor and dividend.