# Thread: Need help with a program!

1. Member
Join Date
Jun 2010
Posts
8
Rep Power
0

## Need help with a program!

I need to add all the prime numbers below an arbitrary number.
Last edited by cid; 07-01-2010 at 01:59 PM.

2. Do you see what I am doing wrong?

3. Member
Join Date
Jun 2010
Posts
8
Rep Power
0
sorry fubarable we have an understanding now

4. Originally Posted by cid
I can't use the % option.
Why not? Did your dog chew on the % key?

kind regards,

Jos

5. 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.

6. Member
Join Date
Jun 2010
Posts
8
Rep Power
0
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.

7. So how is the project doing then?

8. Member
Join Date
Jun 2010
Posts
8
Rep Power
0
horribly. man
Last edited by cid; 07-01-2010 at 02:00 PM.

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

10. Member
Join Date
Jun 2010
Posts
8
Rep Power
0
tried debugging
Last edited by cid; 07-01-2010 at 02:00 PM.

11. 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?

12. Member
Join Date
Jun 2010
Posts
8
Rep Power
0
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.

13. 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.
Last edited by Norm; 07-01-2010 at 03:54 AM.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•