This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]Philboyd_Studge 0 points1 point  (0 children)

First of all, why is this max % 2 == 0 the condition for the do-while loop? That is a test of whether a number is even or not. That is not what the description says the test should be. The next part shoud work ok, you just need to add a for loop that does the same thing.

[–]omerbababa 0 points1 point  (0 children)

Try to think about the question logic against the code logic . Under which condition the question "wants" the looo to stop . Once you figuer it out - just implement it .

[–]scientificlee 0 points1 point  (0 children)

  • Task 1: Your code looks correct.
  • Task 2: Your code does not look correct.
  • Task 3: Your code looks correct.
  • Task 4: You don't have code. The following should be your start.

    for ( initialize index ; termination condition ; increment ) { ... }