From 6bc556f76a0ecff9417439ca298ed168e65a0a7f Mon Sep 17 00:00:00 2001 From: Namrata Mali <107704065+Namrata103@users.noreply.github.com> Date: Thu, 20 Oct 2022 14:18:05 +0530 Subject: [PATCH] Create Matrix Multiplication.cpp --- 2022-Oct/Matrix Multiplication.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 2022-Oct/Matrix Multiplication.cpp 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; +}