+ 7
who understands this code , please explain🙏
5 ответов
+ 8
the variable i iterates 2 times and the j 3 times
i has following value in iteration
1,2
within the second for loop i looks like this
111222
And j looks like this
012012
Now you multiply the values what results in following output
Output
1 * 0 0
1 * 1 1
1 * 2 2
2 * 0 0
2 * 1 2
2 * 2 4
+ 8
First step is i = 1 and j = 0 i + j = 1, and is less than 5 and is print i * j (1 * 0).
2. I = 1 j = 1, I + j = 2 less than 5 not break do it operation I * j = 1.
3. I = 2 j = 0, I + j = 2 less than 5 not break do it operation I * j = 0.
4. I = 2 j = 1, I + j = 3 less than 5 not break do it operation I * j = 2.
5. I = 2 j = 2, I + j = 4 less than 5 not break do it operation I * j = 4.
And for loop don't have more moves and is end.
+ 4
Edward Foster , ok, bro) Don't worry)
0
the two loops goes normal.
as no way i or j get more than 2 and comblete (the fors conditions)
so the if condition wont matter.
- 1
Bro, take a deep breath and get the answer from other people, sorry im not helpfull, BTW: I dont know or understand Java Code! Sorry!