Quick AP Comp Sci help

<p>What does the following code print?</p>

<p>for (int i = 1; i < 10; i++)
{
for(int j = 0; j < 10; j++)
System.out.println(i * j % 10);
System.out.println();
}</p>

<p>I can't figure how to do this question. Can anyone help?</p>

<p>0
1
2
3
4
5
6
7
8
9</p>

<p>0
2
4
6
8
10
12
14
16
18</p>

<p>etc</p>

<p>i believe</p>

<p>can you explain?</p>

<p>anyone????</p>

<p>bump.......</p>

<p>sorry i messed up. here's what i think it should actually be:
0
1
2
3
4
5
6
7
8
9</p>

<p>0
2
4
6
8
0
2
4
6
8</p>

<p>first, the loop starts with the i = 0.
at the beginning of the loop for the int i, it goes to another loop without a bound. therefore, only the function called directly after is looped. so that loop uses j. and it displays a println for i<em>j%10. so essentially, the modulus 10 is having the units digit of the product of i</em>j displayed.</p>

<p>Why don't you compile and run it?</p>