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 na of type double, initialized to ad. Then, until na is less than kocup, increment na.

Solution

for (double na = ad; na <= kocup; na++) {
    ...
}

Something to double-check in your solution:


Related puzzles: