Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A 5 4 - WAP to find the product of given matrix. in C Description: Read no . of rows and columns for 2 arrays

A54- WAP to find the product of given matrix. in C
Description:
Read no.of rows and columns for 2 arrays from user and allocate the memory dynamically using malloc or calloc (Assume Matrix A and Matrix B).
Read the Matrix A and B from user.
Find the product for matrix A with matrix B amd store the result in Matrix R.
Let say Name of the matrix is A and no. Of rows = columns =3.
Matrix A
1
2
3
1
2
3
1
2
3
Matrix B
1
1
1
2
2
2
3
3
3
Final Result :
Result = A * B
123111
R=123 x 222
123333
R1=[(1*1)+(2*2)+(3*3)(1*1)+(2*2)+(3*3)(1*1)+(2*2)+(3*3)]
Result matrix is
14
14
14
14
14
14
14
14
14
Pr-requisites:
2D Arrays / Pointers.
DMA.
Objective:
To understand the concept of
DMA
Double Pointers /2D array.
Inputs:
No.of rows, Columns and row * column values for the matrix A and matrix B.
Sample output:
Test case1:
user@emertxe]./transpose_product
Enter number of rows : 3
Enter number of columns : 3
Enter values for 3 x 3 matrix :
123
123
123
Enter number of rows : 3
Enter number of columns : 3
Enter values for 3 x 3 matrix :
111
222
333
Product of two matrix :
141414
141414
141414
Test case 2:
user@emertxe]./transpose_product
Enter number of rows : 3
Enter number of columns : 3
Enter values for 3 x 3 matrix :
123
123
123
Enter number of rows : 2
Enter number of columns : 3
Matrix multiplication is not possible

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

Learning MySQL Get A Handle On Your Data

Authors: Seyed M M Tahaghoghi

1st Edition

0596529465, 9780596529468

More Books

Students also viewed these Databases questions