-
Notifications
You must be signed in to change notification settings - Fork 0
/
20-42616-1 lab 3 problem 1.cpp
52 lines (44 loc) · 1.13 KB
/
20-42616-1 lab 3 problem 1.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
47
48
49
50
51
52
#include <iostream>
using namespace std;
int main() {
int row, column, i, j;
cout << "Enter the number of rows of input Matrix: ";
cin >> row;
cout << "Enter the number of column of input Matrix: ";
cin >> column;
int Matrix[row][column], TransposeMatrix[column][row];
cout<<"\nPlease enter the value of input Matrix: ";
for (i = 0; i < row; i++)
{
for(j = 0; j < column; j++)
{
cin >> Matrix[i][j];
}
}
cout<<"\n--------------- Matrix ---------------\n";
for (i = 0; i < row; i++)
{
for(j = 0; j < column; j++)
{
cout << Matrix[i][j] << " ";
}
cout << endl;
}
for (i = 0; i < row; i++)
{
for(j = 0; j < column; j++)
{
TransposeMatrix[j][i] = Matrix[i][j];
}
}
cout<<"\n--------------- Transpose Matrix ---------------\n";
for (i = 0; i < column; i++)
{
for(j = 0; j < row; j++)
{
cout << TransposeMatrix[i][j] << " ";
}
cout << endl;
}
return 0;
}