Menu
Coddy logo textTech

Addition of Two Matrix

Lesson 18 of 26 in Coddy's Arrays in C++ course.

challenge icon

Challenge

Given two 2D matrices, print the sum of those two matrices separated by a single space  

Try it yourself

#include<iostream>
using namespace std;

int main(){
  
  int m,n;
  cin>>m>>n;
  
  int m1[m][n];
  int m2[m][n];
  
  for(int i=0;i<m;i++){
    for(int j=0;j<n;j++){
      cin>>m1[i][j];
    }
  }
  
   for(int i=0;i<m;i++){
    for(int j=0;j<n;j++){
      cin>>m2[i][j];
    }
  }
  
  
  //Code here
  
  
  


  

    return 0;
}   

All lessons in Arrays in C++