|
-
August 2nd, 2010, 09:27 AM
#9
Re: Display prime numbers between 1 to 50 using Nested Loops
 Originally Posted by itsmeandnobodyelse
In your first code there are some flaws:
(1) the b = 2; must be moved into the for loop and above while loop
(2) remove the whole else block of the inner while loop.
the (1) means that the b wasn't reset for all a > 4 and therefore the inner loop couldn't work.
the (2) breaks the while loop whenever none of the first conditions was true. That is for each odd number.
Regards, Alex
This is an old thread bumped by a noob looking for somebody to do some homework for him.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|