0% found this document useful (0 votes)
110 views

C Program To Find Transpose of Given Matrix

This C program takes a matrix as input from the user, stores it in a two dimensional array 'a', and calculates the transpose of the matrix by storing it in another two dimensional array 'b'. It prints the original and transpose matrices to the screen. It first gets the row and column sizes, then inputs the matrix values and prints the original matrix. It then initializes the transpose matrix 'b' and calculates the transpose by swapping the row and column indices when assigning values from 'a' to 'b'. Finally, it prints the transpose matrix 'b'.

Uploaded by

Debarpitaa Roy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
110 views

C Program To Find Transpose of Given Matrix

This C program takes a matrix as input from the user, stores it in a two dimensional array 'a', and calculates the transpose of the matrix by storing it in another two dimensional array 'b'. It prints the original and transpose matrices to the screen. It first gets the row and column sizes, then inputs the matrix values and prints the original matrix. It then initializes the transpose matrix 'b' and calculates the transpose by swapping the row and column indices when assigning values from 'a' to 'b'. Finally, it prints the transpose matrix 'b'.

Uploaded by

Debarpitaa Roy
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

//C program to find transpose of given matrix BY CHINMOYEE

#include<stdio.h>
#include <conio.h>
void main()
{
int a[10][10],b[10][10],i,j,m,n;
printf("\n Enter the row and column of matrix : ");
scanf("%d %d",&m,&n);
printf("\n Enter The matrix : ");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
clrscr();
printf ("\n The Numbers Of Row & Column Of Given Matrix Is : %d : %d",m,n);
printf("\n The matrix is :\n");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<m;j++)
{
printf(" %d\t",a[i][j]);
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
b[i][j]=0;
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
b[i][j]=a[j][i];
//printf("\n%d",b[i][j]);
}
}
printf("\n\n Traspose of a matrix is : ");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0;j<m;j++)
{
printf(" %d\t",b[i][j]);
}
}
// return 0;
}
EXAMPLE

You might also like