4
answers
1
watching
88
views
20 Jun 2022
Question 6
Consider the following Java program, which is suppose to compute the transpose of a given 4 x 4 matrix M.
Note: there is an X in the program, which indicates some missing statements.
Choose the correct option to replace X in the program.
#include<java.util.*>
#define ROW 4
#define COL 4
int M[ROW][COL] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
main()
{
int i, j, t;
for (i = 0; i < 4; ++i)
{
X
}
for (i = 0; i < 4; ++i)
for (j = 0; j < 4; ++j)
System.out.println ("%d", M[i][j]);
}
Question 6
Consider the following Java program, which is suppose to compute the transpose of a given 4 x 4 matrix M.
Note: there is an X in the program, which indicates some missing statements.
Choose the correct option to replace X in the program.
#include<java.util.*>
#define ROW 4
#define COL 4
int M[ROW][COL] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
main()
{
int i, j, t;
for (i = 0; i < 4; ++i)
{
X
}
for (i = 0; i < 4; ++i)
for (j = 0; j < 4; ++j)
System.out.println ("%d", M[i][j]);
}
learn4lifeLv10
20 Jun 2022
Already have an account? Log in