Quote Originally Posted by itsmeandnobodyelse View Post
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.