posted 12 years ago
At line no: 10 instead of using i++, prefix increment operator will give the required results.
Since, there is assignment operation taking place, following rule applies:
When a prefix expression is used, the value returned is the value calculated after the prefix operator is applied.When a postfix expression is used, the value returned is the value calculated before the postfix operator is applied.