Matrix transpose
C++ Loops
nested loops, swap
Flowchart (ISO 5807)
Source code
void transpose(int a[][100], int n) {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
int t = a[i][j];
a[i][j] = a[j][i];
a[j][i] = t;
}
}
}