My code gives the right output:
==========================
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
.........................................
10 20 30 40 50 60 70 80 90 100
==========================
BUT, it's irrelevant according to the conditions, because the table should have 10 x 10 dimensions, unlike mine 11 x 11.
Once I change it to 10 x 10, the code asked to be changed a fori iteration, from
(int i = 1; i <= 10; i++ )
to
(int i = 1; i < 10; i++)
otherwise, it doesn't compile.
and gives me the following output:
============================
1 2 3 4 5 6 7 8 9
2 4 6 8 10 12 14 16 18
.................................................
9 18 27 36 45 54 63 72 81
============================
Can't figure out how to make it initializing the 10th element without being faced with errors.
Please, help.package en.codegym.task.pro.task05.task0509;
/*
Multiplication table
*/
public class Solution {
public static int[][] MULTIPLICATION_TABLE;
public static void main(String[] args) {
MULTIPLICATION_TABLE = new int[11][11];
for (int i = 1; i <= 10; i++) {
for (int j = 1; j <= 10; j++){
MULTIPLICATION_TABLE[i][j] = (i * j);
System.out.print(MULTIPLICATION_TABLE[i][j] + " ");
}
System.out.println();
}
}
}