quiz 3 - loops\nthe code below was rejected by a lead programmer:\nn = 0\nwhile (n < 10)\n display(\woo\)\n…

quiz 3 - loops\nthe code below was rejected by a lead programmer:\nn = 0\nwhile (n < 10)\n display(\woo\)\n n = n - 1\nwhy do you think this code was rejected?
Answer
Brief Explanations:
The code has a logical error in the increment operation. In the line n = n - 1, instead of incrementing n (which is needed to eventually exit the loop when n < 10 is no longer true), it is decrementing n. So the loop will either run infinitely (if the language allows n to go into negative values without bounds) or until some system - imposed limit on negative values is reached, and will not achieve the likely intended goal of looping 10 times.
Answer:
The n = n - 1 statement decrements n instead of incrementing it, which may lead to an infinite loop or incorrect loop behavior.