-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path(5)2D array.cpp
46 lines (44 loc) · 919 Bytes
/
(5)2D array.cpp
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
#include<iostream>
using namespace std;
int main()
{
int i,j,r1,c1,r2,c2,m1[100][100],m2[100][100],m3[100][100];
cout<<"Enter the size of the first matrix:";
cin>>r1>>c1;
cout<<"Enter elements:"<<endl;
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
{
cin>>m1[i][j];
}
}
cout<<"Enter the size of the second matrix:";
cin>>r2>>c2;
cout<<"Enter elements:"<<endl;
for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++)
{
cin>>m2[i][j];
}
}
cout<<"First matrix:"<<endl;
for(i=0;i<r1;i++)
{
for(j=0;j<c1;j++)
{
cout<<" "<<m1[i][j];
}
cout<<endl;
}
cout<<"Second matrix:"<<endl;
for(i=0;i<r2;i++)
{
for(j=0;j<c2;j++)
{
cout<<" "<<m2[i][j];
}
cout<<endl;
}
}