Two things:
- Fix the while condition: you are only interested in numbers above 20
- You need to decrement the counter variable.
See the changes below:
while (counter > 20) {
// Subtract 5 from the counter.
counter -= 5;
// Print the value of the counter on a line by itself.
printf("%d\n", counter);
}
0
solved Counting down in increments of 5 [closed]