+ 2
I am not getting this code
9 Answers
+ 17
int m=2;
int n=15;
for (int i=1; i<5; i++) {
m++;
--n;
// i = 1, m = 3, n = 14
// i = 2, m = 4, n = 13
// i = 3, m = 5, n = 12
// i = 4, m = 6, n = 11
}
+ 16
@Malhar, --n before print statement tells you that -- decreases the current value of n (which is 15) by one. So, your first outputted value is 14. Is it clear now?
+ 5
i is 1 2 3 4 following
Which mean loop executed 4 times
so n decreased by 1 4 times
+ 1
sorry I meant to say how no 15
0
n is 15
0
can anyone help please
0
n is 15
0
and the output is n=14 how is it 14
0
how is it possible