Computer Science Canada problem with prime numbers |
Author: | amir20001 [ Thu Feb 11, 2010 10:48 pm ] | ||
Post subject: | problem with prime numbers | ||
This is probably something obvious but i dont understand whats wrong with it can some one explain it for me. thx in advance |
Author: | DemonWasp [ Fri Feb 12, 2010 4:03 am ] |
Post subject: | RE:problem with prime numbers |
The if (prime[k]) line is missing its block ( curly braces - { and } ) and therefore only affects the line after it, which is an output line. Based on the indenting, you want a block around the contained for(){} loop. |
Author: | Barbarrosa [ Fri Mar 05, 2010 10:20 pm ] | ||
Post subject: | Re: problem with prime numbers | ||
Based on my current understanding, this block of code alters the area one space before each array. I don't believe that's what you intended to do, so you should probably start those loops at or after zero.
|