I do not know that you do not understand where
may be the difference between do {statement }while(exprssion )
and while(expression){statement}
in one
word if do{statement} while(exprssion) the expression is evaluated after the statement is executed. While the expression is true, the statement is executed repeatedly.
if while(exprssion ){statement } exprssion first and then statement executing
this is steps of this program executing
i j
10 5
9 6
8 7
7 8
after it while (j--<i++) will executed one time ,but the exprssion is false
hence do {}while() ends and now i=6;j=9
executed for (initialization-expression;loop-expression;update-expression)
statement
update-expression first hence i--, now i=5
then executed loop-exprssion i>5,hence loop-exprssion is false ,so for loops ends
if you change your code like this
you will get some different result