Question: We have declared a variable of type int called n . TASK: Create a variable of type int[][] called products that has n rows and
We have declared a variable of type int called n.
TASK: Create a variable of type int[][] called products that has n rows and n columns (i.e., n-by-n) in which the i-th row of the j-th column contains the product (i + 1) * (j + 1).
EXAMPLE: products[0][0] is 1 * 1 = 1, and products[3][3] is 4 * 4 = 16.
NOTE: Do not print anything. We take care of printing behind the scenes. Just create the 2d array
NOTE: You do not need to create a class or a main method. Just write the code to create the 2d array.
HINT: Review the lecture slides on arrays - they contain a blueprint for looping through a 2-D array that you will find helpful
Sample Input:
5
Sample Output:
1 2 3 4 5 2 4 6 8 10 3 6 9 12 15 4 8 12 16 20 5 10 15 20 25
Write a program, test using stdin stdout
PLEASE ANSWER USING JAVA
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
