Translate the following natural language description of a loop into a for loop:
Declare a variable namednemof typeint, initialized tose. Then, untilnemis not equal tonemar, incrementnem.
for (int nem = se; nem != nemar; nem++) {
...
}
Something to double-check in your solution:
nem != nemar)?Consider the following code:
A B while (C) { D E if (F) { G H break; } I } J K L
Assume the loop ends because the test condition of the loop is false on iteration 1. Write out the the order in which the statements will execute.
Assume the loop ends because the test condition of the loop is false on iteration 3. Write out the the order in which the statements will execute.
Order:
A B C D E I J K L
Order:
A B C D E F G H I C D E F G H I C D E I J K L
Related puzzles: