diff --git a/2022-Oct/Matrix Multiplication.cpp b/2022-Oct/Matrix Multiplication.cpp new file mode 100644 index 00000000..adbb34b0 --- /dev/null +++ b/2022-Oct/Matrix Multiplication.cpp @@ -0,0 +1,29 @@ +#include +using namespace std; +int main() { + // your code goes here + int n,m,i,j; + cin >> n >> m; + int A[n][m]; + for(i = 0; i < n; i++){ + for(j = 0; j < m; j++){ + cin >> A[i][j]; + } + } + cin >> n >> m; + int B[n][m]; + for(i = 0; i < n; i++){ + for(j = 0; j < m; j++){ + cin >> B[i][j]; + } + } + int C[n][m]; + for(i = 0; i < n; i++){ + for(j = 0; j < m; j++){ + C[i][j] = A[i][j] + B[i][j]; + cout << C[i][j] << " "; + } + cout << endl; + } + return 0; +}