JavaScript is required

Đầu ra là gì?

A.

A.4

B.

0

C.

1

D.

5

Trả lời:

Đáp án đúng: A


The code initializes x to 5. The while loop continues as long as x > 0. Inside the loop, x is decremented by 1 and then printed. Thus, the loop prints 4, 3, 2, 1, 0. The loop terminates when x becomes 0. The correct answer is 0.

Câu hỏi liên quan