-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMultiply_two_array_2D.txt
More file actions
47 lines (34 loc) · 1015 Bytes
/
Multiply_two_array_2D.txt
File metadata and controls
47 lines (34 loc) · 1015 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
42
43
44
45
46
47
using namespace std;
#include <iostream>
int main() {
/* Write a program to read two array(two-dimensional) and then multiply them.
*/
const int row = 2;
const int col = 2;
int arr1[row][col];
int arr2[row][col];
int arr3[row][col];
cout << "Enter Elements of Array 1 " << endl;
for(int i = 0; i < row ; i++){
for(int j = 0; j < col ; j ++){
cin >> arr1[i][j];
}
}
cout << "Enter Elements of Array 2 " << endl;
for(int i = 0; i < row ; i++){
for(int j = 0; j < col ; j ++){
cin >> arr2[i][j];
}
}
for(int i = 0; i < row ; i++){
for(int j = 0; j < col ; j ++){
arr3[i][j] = arr1[i][j] + arr2[i][j];
}
}
for(int i = 0; i < row ; i++){
for(int j = 0; j < col ; j ++){
cout << arr3[i][j] << " ";
}
}
return 0;
}