Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a function to find the transpose of a 2x3 matrix {{1, 2, 3}, {4, 5, 6}}.

Medium

Problem Statement

Write a function to find the transpose of a 2x3 matrix {{1, 2, 3}, {4, 5, 6}}.

Sample Input

Matrix:
 1 2 3
 4 5 6

Sample Output

1 4 
2 5 
3 6 

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
#include <stdio.h> void transposeMatrix(int matrix[2][3], int transposed[3][2]) { // Your code here } int main() { int matrix[2][3] = {{1, 2, 3}, {4, 5, 6}}; int transposed[3][2]; transposeMatrix(matrix, transposed); for (int i = 0; i < 3; i++) { for (int j = 0; j < 2; j++) { printf("%d ", transposed[i][j]); } printf("\n"); } return 0; }
Log in or sign up to run or submit your code.Log inSign up
Input
Matrix:
 1 2 3
 4 5 6
Expected Output
1 4 
2 5 
3 6