107k views
2 votes
How many times would the following loop iterate?

Set k = 1
While k < 5
Display k
Set k = k + 1
End While

User CervEd
by
5.5k points

1 Answer

2 votes

Answer:

The answer to this question is given below in the explanation section

Step-by-step explanation:

The code is :

Set k = 1

While k < 5

Display k

Set k = k + 1

End While

this is a while loop, that will iterate 4 times and display the body of loop. and at the fifth iteration, the loop condition does not meet the condition and the loop will get terminated.

User Lluisaznar
by
5.2k points