C Source Code/Transpose of a matrix

#include<stdio.h>
#include<conio.h>
void main()
{
int a[100][100],b[100][100],i,j,m,n;
clrscr();
printf("Enter number of rows.\n");
scanf("%d",&m);
printf("Enter number of columns.\n");
scanf("%d",&n);
for(i=0;i<m;i++)
  {
  for(j=0;j<n;j++)
   {
   printf("enter number.\n");
   scanf("%d",&a[i][j]);
   }
  }
for(i=0;i<m;i++)
  {
  for(j=0;j<n;j++)
   {
   b[i][j]=a[j][i];
   }
  }
printf("given matrix:\n");
for(i=0;i<m;i++)
  {
  for(j=0;j<n;j++)
   {
   printf("%d  ",a[i][j]);
   }
  printf("\n");
  }
printf("transpose of given matrix:\n");
for(i=0;i<m;i++)
  {
  for(j=0;j<n;j++)
   {
   printf("%d  ",b[i][j]);
   }
  printf("\n");
  }
getch();
}






/*OUTPUT:

enter number.
2
enter number.
3
enter number.
4
enter number.
5
enter number.
6
enter number.
7
enter number.
8
enter number.
9
given matrix:
1  2  3
4  5  6
7  8  9
transpose of given matrix:
1  4  7
2  5  8
3  6  9*/