[Solved] What is the output of it and how? [closed]


If your question is why you are getting 5:
1. So you start your loop with 1.
2. You check if 1 is smaller than 5. -> It is not, so the condition is false.
3. Then you print 1.
4. You repeat steps 1-3 again for x=2,3,4,5, because all are not bigger than 5
5. At x=6 you check again if x is bigger than 5 -> condition is true und the break statement is executed and you leave the for loop.
End of the execution
Your output:
1
2
3
4
5

7

solved What is the output of it and how? [closed]