Write a program that de%uFB01nes 3 matrices A, B and C of size 3x3 with int elem
ID: 3536440 • Letter: W
Question
Write a program that de%uFB01nes 3 matrices A, B and C of size 3x3 with int elements. The
matrizes should be represented as 2D-arrays. Have the user input matrizes A and B row-by
row, as shown in the below example. Compute the matrix product of A and B and store the
result in C (i.e., C = A*B). Print matrix C on the screen. You can %uFB01nd more information on the matrix product at the following wikipedia page (scroll down to %u201CMatrix Product%u201D):
http://en.wikipedia.org/wiki/Matrix_multiplication.
To format the output of matrix C, you must determine the largest number occurring in matrix C,
and output all numbers with this %uFB01eld width to make matrix columns aligned. For example, in
the below result matrix C, the largest number is 12. 12 has 2 digits, so all numbers must be
output with a %uFB01eld width of two. Note also the additional blank to separate columns.
Enter matrix A:
1 2 3
1 2 3
1 1 1
Enter matrix B:
1 2 1
1 2 1
2 2 3
Product matrix C:
9 12 12
9 12 12
4 6 5
Explanation / Answer
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.