About Question enthuware.ocajp.i.v8.2.1233 :
Posted: Tue Oct 18, 2016 9:35 am
Explaination says: "In the first iteration of for loop, the while loop keeps running till c becomes 6. Now, for all next for loop iteration, the while loop never runs as the flag is false. So final value of c is 6."
I think while loop keeps running till c becomes 5 instead of 6 because the while loop is:
while(flag){
c++;
if(i>c || c>5) flag = false;
}
and not
while(flag){
c++;
if(i>c || c>=5) flag = false;
}
Am I missing something?
I think while loop keeps running till c becomes 5 instead of 6 because the while loop is:
while(flag){
c++;
if(i>c || c>5) flag = false;
}
and not
while(flag){
c++;
if(i>c || c>=5) flag = false;
}
Am I missing something?