0
What is the logical error in the programe which is written for adding two matrices?
#include <iostream> using namespace std; int main() { int a[2][2]; int b[2][2]; int c[2][2]; int i; int j; for(i=0;i<2;i++) { for(j=0;j<2;j++) { cin >> a[i][j]; cin >> b[i][j]; c[i][j] = a[i][j] + b[i][j]; cout << c[i][j]; } } return 0; }
1 Answer
+ 1
Adarsh K it's working for input as below:
1 2 3 4 5 6 7 8
please note that on sololearn app, you need to provide all input in one go either seperated by space or new line.
please share details of input and expected output if you are not getting proper output in case..