Quiz: Another Pseudocode Example
Click Start and answer the questions below.
What is the first number printed? | 10 | 10 > 1, so we enter the loop and print it. |
What is the second number printed? | 5 | 10 is even, so n = 10 / 2 = 5. |
What is the next number printed? | 16 | 5 is odd, so n = 3 n + 1 = 16. |
What are the next three numbers printed? Separate them by spaces. | 8 4 2 | They are all even, so each time they are cut in half. |
2 is even, so it is divided by 2 as well, yielding 1. What is printed next? Enter 1 or the word nothing. | nothing | Since n = 1, the loop is not entered. It is only entered if n > 1. |