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 pri. Then, until ni is less than or equal to ciSo, decrement ni.

Solution

for (double ni = pri; ni < ciSo; ni--) {
    ...
}

Something to double-check in your solution:


Related puzzles: