previous | start | next

Common Error: Infinite Loop

while (year < 20)

   balance = balance +
      balance * rate / 100; 
}

while (year > 0)

   year++; // oops, meant --
   . . .
}

Loops run forever--must kill program


previous | start | next