function displayTransposeMatrix(matrix) {
const rows = matrix.length;
const cols = matrix[0].length;
for (let i = 0; i < cols; i++) {
let s = "";
for (let j = 0; j < rows; j++) {
s += matrix[j][i] + " ";
}
console.log(s);
}
}
const matrix = [ [1, 2, 3, 5],
[4, 5, 6, 1],
[7, 8, 9, 0] ];
displayTransposeMatrix(matrix);
/*
run:
"1 4 7 "
"2 5 8 "
"3 6 9 "
"5 1 0 "
*/