0

Hey, can anyone solve this in array in c language? Multiplication of two matrix.

Write a function solution that accepts two M1 x N1 and M2 x N2 size matrices (A1 and A2 respectively) and four integers M1, N1, M2 and N2. The function should return multiplication of these matrices. If a multiplication is not possible return 1 x1 matrix with value -1 Input 2 3 551 234 3 1 3 4 Where, • First line of input represents the number of rows of first Matrix. (M1) • Second line of input represents the number of columns of first Matrix. (N1). • Third line onwards contains first matrix elements of 1st row and so on. • Fifth (Value of M1 + 3) line of input represents the number of rows of a second Matrix. (M2) • Sixth (Value of M1 + 4) line of input represents the number of columns of a second Matrix. (N2). • Seventh (Value of M1 + 5) line onwards contains second matrix elements of 1st row and so on Output 29 29 Here for the given 2 x 3 and 3 x1 matrices, 551 234 and 2 3 4 the multiplication will be 5*2 + 5*3 + 1*4 = 29 2*2 + 3*3 + 4*4 = 29 Hence final 2 x1 matrix will be 29 29

13th Jul 2021, 2:29 PM
sunny chauhan
2 Answers
+ 1
Others are unlikely to do your assignments for you. If you need help, try to solve it yourself first, and when you get stuck at any point, feel free to link your code and explain where your issue lies. As a starting point, you can find articles on the net on how to implement matrix multiplication: https://www.programmingsimplified.com/c-program-multiply-matrices https://www.geeksforgeeks.org/c-program-multiply-two-matrices/ You can also find code samples on the code playground: https://code.sololearn.com/cjCydZWFJU58/?ref=app https://code.sololearn.com/c8i2A39SWAHt/?ref=app
13th Jul 2021, 2:51 PM
Shadow
Shadow - avatar
0
Give it a shot! I will try to help you out once you have given your effort into it. Just create the code, save it in Playground, edit your post (above), and share the code link in the Description. Here's how to share code link, in case you didn't know https://www.sololearn.com/post/75089/?ref=app
13th Jul 2021, 2:58 PM
Ipang