0% found this document useful (0 votes)
7 views2 pages

Transpose of A Matrix

The document contains a C program that transposes a given matrix. It prompts the user to input the number of rows and columns, followed by the elements of the matrix. After displaying the original matrix, it prints the transposed version of the matrix.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Transpose of A Matrix

The document contains a C program that transposes a given matrix. It prompts the user to input the number of rows and columns, followed by the elements of the matrix. After displaying the original matrix, it prints the transposed version of the matrix.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Write a c progt Tanspose the matrix.

#include <stdio.h>

void main()

int arrl(50][50], brr1 (50|[|50],ij,z,c;


printf("\|n\nTranspose of a Matrix \n");
printf('-.

ntf("\ nlnput the rows and columns of the matrix : ;


scanf("%d % d", &T, &c);
orint{("Input elements in the first matrix :\n");
for(i=-0;i<r;it+)

for(j=0;j<c;j+t)

printf("'element - [%d],[% d]: "i):


scanf("% d", karr1 [i] il):

printf("\ nThe matrix is :\n");


for(i-0;i<r;it+)
printf("\|n");
for(j=0;j<c;j+t+)
printf("% d\t",arr1[i] lil);
for(i=0;i<r;it+)
for(j-0;j<cjt+)
brrljli]=ar1[i]6};
printf("\n\ nThe transpose of a matrix is : ");
for(i=0;i<c;itt)l
printf("\n');
printf("%d\t", brrl[i]li);

printf("\n\n");
Output:
Transpose of a Matrix:
Input the rows and columns of the matríx :22
Input elements in the first matrix :
element - [0],[0] :1
element -[0],[1] : 2
element - [1],(0] : 3
element - [1],[1] : 4
The matrix is :
1 2
3 4
The transpose of a matrix is :
1 3
2 4

You might also like