forked from VinayBelwal/Hactober-22-Programs-and-Projects-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
transpose_of_matrix.cpp
44 lines (44 loc) · 1.08 KB
/
transpose_of_matrix.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
#include<iostream>
using namespace std;
int main()
{
int arr1[3][3], i, j, arr2[3][3];
cout<<"\n Enter 3*3 Array Elements : \n";
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
cout<<" ";
cin>>arr1[i][j];
}
}
cout<<"\n Array Elements : \n";
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
cout<<" ";
cout<<arr1[i][j]<<"\t";
}
cout<<"\n";
}
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
cout<<" ";
arr2[i][j]=arr1[j][i];
}
}
cout<<"\n\n Transpose of the Matrix is :\n";
for(i=0; i<3; i++)
{
for(j=0; j<3; j++)
{
cout<<" ";
cout<<arr2[i][j]<<"\t";
}
cout<<"\n";
}
return 0;
}