| 2 | using namespace std; |
| 3 | |
| 4 | int main() { |
| 5 | int a[10][10], transpose[10][10], row, column, i, j; |
| 6 | |
| 7 | cout << "Enter rows and columns of matrix: "; |
| 8 | cin >> row >> column; |
| 9 | |
| 10 | cout << "\nEnter elements of matrix: " << endl; |
| 11 | |
| 12 | for (int i = 0; i < row; ++i) { |
| 13 | for (int j = 0; j < column; ++j) { |
| 14 | cout << "Enter element a" << i + 1 << j + 1 << ": "; |
| 15 | cin >> a[i][j]; |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | cout << "\nEntered Matrix: " << endl; |
| 20 | for (int i = 0; i < row; ++i) { |
| 21 | for (int j = 0; j < column; ++j) { |
| 22 | cout << " " << a[i][j]; |
| 23 | if (j == column - 1) |
| 24 | cout << endl << endl; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | for (int i = 0; i < row; ++i) |
| 29 | for (int j = 0; j < column; ++j) { |
| 30 | transpose[j][i] = a[i][j]; |
| 31 | } |
| 32 | |
| 33 | cout << "\nTranspose of Matrix: " << endl; |
| 34 | for (int i = 0; i < column; ++i) |
| 35 | for (int j = 0; j < row; ++j) { |
| 36 | cout << " " << transpose[i][j]; |
| 37 | if (j == row - 1) |
| 38 | cout << endl << endl; |
| 39 | } |
| 40 | |
| 41 | return 0; |
| 42 | } |
nothing calls this directly
no outgoing calls
no test coverage detected