Answer:
#include <iostream>
#include <cstdlib>
using namespace std;
int m, n;
void transpose(int matrix[]){
 int transp[m][n];
 for (int i = 0; i < n; i++){
 for (int j = 0; j < m; j++){
 transp[j][i] = matrix[i][j];
 cout<< transp[j][i]<< " ";
 }
 cout<< "\\";
 }
}
int main(){
 cout<< "Enter the value for n: ";
 cin>> n;
 cout>> "Enter the value for m: ";
 cin>> m;
 int mymatrix[n][m];
 for (int i = 0; i < n; i++){
 for (int j = 0; j < m; j++){
 mymatrix[i][j] = (rand() % 50);
 }
 }
 transpose(mymatrix);
}
Step-by-step explanation:
The C source code defined a void transpose function that accepts a matrix or a two-dimensional array and prints the transpose on the screen. The program gets user input for the row (n) and column (m) length of the arrays. The C standard library function rand() is used to assign random numbers to the array items.