#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],m,i,j,temp;
/* actual size of matrix is m*n
i,j - for scanning of array
temp - for interchanging of a[i][j] and a[j][i] */
printf("\n Enter the size of matrix :");
scanf("%d",&m);
/* Reading elements of matrix */
printf("\n Enter the values a:");
for(i=0;i<m;i++)
for(j=0;j<m;j++)
scanf("%d",&a[i][j]);
//to print original square matrix
printf("\nGiven square matrix is");
for(i=0;i<m;i++)
{
printf("\n");
for(j=0 ; j 〈 m ; j++)
printf("%d\t",a[i][j]);
}
/* Find transpose */
for(i=1;i<m;i++)
for(j=0;j<i;j++)
{
temp=a[i][j];
a[i][j]=a[j][i];
a[j][i]=temp;
}
/* printing of all elements of final matrix */
printf("\nTranspose matrix is :");
for(i=0;i 〈 m;i++)
{
printf("\n");
for(j=0;j<m;j++)
printf("%d\t",a[i][j]);
}
getch();
}

Incoming search terms:

About the author: Pritesh View all posts by Pritesh
My name is Pritesh Taral. I am working in well known MNC. as Java Developer. I am part time blogger loves writing articles on C/C++. I am active on facebook using community fan page .One can Visit me @ Facebook
Facebook Fan Page