-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddmatrices.cpp
More file actions
41 lines (40 loc) · 792 Bytes
/
Copy pathaddmatrices.cpp
File metadata and controls
41 lines (40 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<iostream>
#include<vector>
using namespace std;
int main(){
int n,m;
cin>>m>>n;
int arr[m][n];
int arr2[m][n];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>arr[i][j];
}
}
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cin>>arr2[i][j];
}
}
int arr3[m][n];
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
arr3[i][j]=arr[i][j]+arr2[i][j];
}
}
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
cout<<arr3[i][j];
}
cout<<endl;
}
// int sum=0;
// // int max=arr[0][0];
// for(int i=0;i<m;i++){
// for(int j=0;j<n;j++){
// sum+=arr[i][j];
// }
// }
// cout<<sum;
return 0;
}