C#

for (int i = 0; i < rows; i++) { for (int j = i + 1; j < col; j++) { temp = arr[i][j]; arr[i][j] = arr[j][i]; arr[j][i] = temp; } } for (int i = 0; i < rows; i++) { for (int j = 0; j < col / 2; j++) { temp = arr[i][j]; arr[i][j] = arr[i][col - 1 - j]; arr[i][col - 1 - j] = temp; }