quiz 3 - loops\nconsider the line of code below:\nn = 0\nwhile (n < 6)\n display(\woo\)\n n = n + 2\nhow…

quiz 3 - loops\nconsider the line of code below:\nn = 0\nwhile (n < 6)\n display(\woo\)\n n = n + 2\nhow many times will \woo\ be displayed?\n6\n3\n5\n1

quiz 3 - loops\nconsider the line of code below:\nn = 0\nwhile (n < 6)\n display(\woo\)\n n = n + 2\nhow many times will \woo\ be displayed?\n6\n3\n5\n1

Answer

Explanation:

Step1: Initialize variable

$n = 0$

Step2: First loop check

Since $0<6$, "woo" is displayed, and $n=n + 2=2$

Step3: Second loop check

Since $2<6$, "woo" is displayed, and $n=n + 2=4$

Step4: Third loop check

Since $4<6$, "woo" is displayed, and $n=n + 2=6$

Step5: Fourth loop check

Since $6\not<6$, loop ends.

Answer:

3