why answer is 6 not 5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

why answer is 6 not 5

12th Aug 2016, 12:16 AM
Mohamed Fawzy
Mohamed Fawzy - avatar
2 Answers
0
The variable is incremented AFTER it is checked. Since 5 < 6 is true, the code continues to the next line. The next line increments the variable up from 5 to six. The loop then ends and you have 6.
17th Aug 2016, 2:53 PM
Max
Max - avatar
- 1
Is "O"not 0
13th Aug 2016, 9:28 AM
fanrui