Given three integer matrices A(m*n),B(m*n) and C(m*n) . Print the one with more zero elements.
I just can’t understand how I can just deduce where there are more zero elements. #include<iostream> using namespace std; int main() { int m, n, p, q, l, v , i, j, k; int a[10][10], b[10][10], c[10][10], res[10][10]; cout << "Enter the order of first matrix\n"; cin >> n >> m; cout << "Enter the order of second matrix\n"; cin >> p >> q; cout << "Enter the order of third matrix\n"; cin >> l >> v; if (n != p) { cout <<"Matrix is incompatible for multiplication\n"; } else { cout << "Enter the elements of Matrix-A:\n"; for (i = 0; i < m; i++) { for (j = 0; j < n; j++) { cin >> a[i][j]; } } cout << "Enter the elements of Matrix-B:\n"; for (i = 0; i < p; i++) { for (j = 0; j < q; j++) { cin >> b[i][j]; } } cout << "Enter the elements of Matrix-C:\n"; for (i = 0; i < l; i++) { for (j = 0; j < v; j++) { cin >> c[i][j]; } } for (i = 0; i < m; i++) { for (j = 0; j < q; j++) { res[i][j] = 0; for (k = 0; k < p; k++) { res[i][j] += a[i][k] * b[k][j]; } } } cout << "The product of the two matrices is:-\n"; for (i = 0; i < m; i++) { for (j = 0; j < q; j++) { cin>> res[i][j]; } cout <<"\n"; } } return 0; }