# Need help with a program!

• 06-30-2010, 07:04 PM
cid
Need help with a program!
I need to add all the prime numbers below an arbitrary number.
• 06-30-2010, 07:13 PM
Fubarable
Quote:

Do you see what I am doing wrong?
• 06-30-2010, 07:23 PM
cid
sorry fubarable we have an understanding now
• 06-30-2010, 07:59 PM
JosAH
Quote:

Originally Posted by cid
I can't use the % option.

Why not? Did your dog chew on the % key?

kind regards,

Jos
• 06-30-2010, 10:19 PM
Norm
Quote:

I can't use the % option
Is that a requirement from the instructor: you can not use the modulus operator?

What is your algorithm for determining if a number is prime? Not the definition, a list of steps to determine it.
• 06-30-2010, 11:07 PM
cid
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.
• 06-30-2010, 11:35 PM
Norm
So how is the project doing then?
• 06-30-2010, 11:50 PM
cid
horribly. man
• 06-30-2010, 11:53 PM
Norm
Try debugging your code by printing out each number it tests and show whether that number is prime or not.
• 07-01-2010, 01:06 AM
cid
tried debugging
• 07-01-2010, 01:48 AM
Norm
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, 02:10 AM
cid
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, 02:52 AM
Norm
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.