forked from iamAnki/CPP-Programs-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTranspose
More file actions
43 lines (39 loc) · 852 Bytes
/
Transpose
File metadata and controls
43 lines (39 loc) · 852 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
#include <iostream>
using namespace std;
int main()
{
static int array[10][10];
int i, j, m, n;
cout<<"Enter the order of the matrix \n";
// Inputing elements in matrix from user
cin>>m>>n;
cout<<"Enter the coefiicients of the matrix\n";
for (i = 0; i < m; ++i)
{
for (j = 0; j < n; ++j)
{
cin>>array[i][j];
}
}
//Printing the original matrix
cout<<"The given matrix is \n";
for (i = 0; i < m; ++i)
{
for (j = 0; j < n; ++j)
{
cout<<" "<<array[i][j];
}
cout<<"\n";
}
//Printing the transpose of matrix
cout<<"Transpose of matrix is \n";
for (j = 0; j < n; ++j)
{
for (i = 0; i < m; ++i)
{
cout<<" "<<array[i][j];
}
cout<<"\n";
}
return 0;
}