Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Source code: #include #include int main() { int M,N,X,Y,I,J,K; int A[20][20], B[20][20], P[20][20]; cout>M; cout>N; cout>A[I][J]; cout>X; cout>Y; cout>B[I][J]; cout AIM: Multiplication of two Matrices

image text in transcribed

Source code: #include #include int main() { int M,N,X,Y,I,J,K; int A[20][20], B[20][20], P[20][20]; cout>M; cout>N; cout>A[I][J]; cout>X; cout>Y; cout>B[I][J]; cout AIM: Multiplication of two Matrices Description: Here A is a two dimensional array with M rows and N columns. B is also a two-dimensional array with X rows and Y columns. This algorithm multiplies these two arrays. The output of the process will be matrix P with M rows and Y columns. Algorithm: (Multiplication of two Matrices) 1. Get dimensions of Matrix- A from user i.e. MX N [Read values for Matrix-A] 2. Repeat for I = 0 to M-1 3. Repeat for ) = 0 to N-1 4. Read A[I][J] [ Get value from user ] [End of Step-3 for Loop ] [ End of Step-2 for Loop ] 5. Get dimensions of Matrix-B from user i.e. X X Y [Read values for Matrix-B ] 6. Repeat for I = 0 to X-1 7. Repeat for ) = 0 to Y-1 8. Read B[I][J] [Get value from user ] [End of Step-7 for Loop ] [ End of Step-6 for Loop ] 9. If (N + X) then Write: "Multiplication is not possible, incompatible dimensions". and exit 10. Repeat for I = 0 to M-1 11. Repeat for ) = 0 to Y-1 12. Set P[I][j] = 0 13. Repeat For K = 0 to X-1 14. Set P[1][2] = P[I][J] + A[I][K] * B[K][J] [ End of Step-13 for Loop ] [ End of Step-11 for Loop ] [ End of Step-10 for Loop] [End of If of step-9 ] 15. Print the Matrix-P 16. End

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

2. To compare the costs of alternative training programs.

Answered: 1 week ago