0

Why result changes?!!!

Why removing the cout in first for loop causes output changing?!! And whats the true result of code? https://code.sololearn.com/c6V5xnUVWzr2/?ref=app

14th Jan 2019, 10:46 PM
Masoud HMD
Masoud HMD - avatar
1 Respuesta
+ 1
Your code as written only loops one time in that first for as the break is always executed. You would need braces to make the break part of the if statement to get the same results as deleting the cout (making the break nested within the if).
15th Jan 2019, 10:59 PM
John Wells
John Wells - avatar