While loops and for loops: Correct Solution


Part 1

Translate the following natural language description of a loop into a for loop:

Declare a variable named ni of type double, initialized to 92. Then, until ni is not equal to zaWeng, subtract 3 from ni.

Solution

for (double ni = 92; ni != zaWeng; ni -= 3) {
    ...
}

Something to double-check in your solution:


Related puzzles: