0
[SOLVED]Why this code is not giving correct output? (Multiply 2 matrices) c++
https://code.sololearn.com/cgfKtdTIL7Mg/?ref=app If I give M1(2*1) = 1 2 And M2(1*2) = 3 4 Then M3(2*2) should be = 3 4 6 8 But output is 0 0 0 0 And for other values also, it gives incorrect outputs (not always o). I can't figure out the error here. Please help. (And yes, I need to find the error here not any other method to find multiplication) (Ignore spelling or grammar mistakes, if any😁)
5 Antworten
+ 6
Yugal Kishore at line 76 , it is M2 not M1
+ 2
Abhay thanks.
This silly mistake took 1 hour of frustration!
+ 2
Happens sometimes , happy coding :)
+ 2
On the for loop with the comment "getting M2"
You are using M1 when you want to use M2
+ 1
Anastacia Ru yup I got it now. thanks for answering.