C Program To Find Transpose a 3 * 2 matrix.
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
main()
{
int arr[3] [2];
int i, j;
clrscr();
printf(" Enter the 6 elements of matrix\n ");
for( i = 0; i < 3; i++ )
for( j = 0; j < 2; j++ )
scanf(" %d ", &arr[i] [j]);
printf(" The matrix is\n ");
for( i = 0; i < 3; i++ )
{
for( j = 0; j < 2; j++ )
printf(" %d ", arr[i] [j]);
printf(" \n ");
}
printf(" The Transposed Matrix is\n ");
for( i = 0; i < 2; i++ )
{
for( j = 0; j < 3; j++ )
printf(" %d ", arr[j] [i]);
printf("\n");
}
getch();
}
OUTPUT:
Enter the 6 elements of matrix
34
63
64
92
16
82
The matrix is
34 63
64 92
16 82
The Transposed Matrix is
34 64 16
63 92 82
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com