The statement that correctly completes the loop is years= years - 1;.
The code snippet given is
int years = 20;
double balance = 10000;
while (years > 0)
{
__________
double interest = balance * rate / 100;
balance = balance + interest;
}
The given code has an error in the loop. The loop will run infinitely as the condition years>0 will always be true, as there is no increment or decrement happening to the variable which is involved in decision making of the loop.
To correctly execute the we have to decrement the value of years for every iteration. After 20 iterations, the value of years will be less than 0. The loop will stop.
The correct code snippet is
int years = 20;
double balance = 10000;
while (years > 0)
{
years= years - 1;
double interest = balance * rate / 100;
balance = balance + interest;
}
To learn more about infinite loops refer here
https://brainly.com/question/13142062#
#SPJ4