C program to accept a matrix of order MxN and find its transpose

by Nideesh C on April 13, 2011 · 1 comment

in C Programming




/*  C program to accept a matrix of order MxN and find its transpose */

#include <stdio.h>
void main ()
{
static int ma[10][10];
int i,j,m,n;

printf (“Enter the order of the matrix \n”);
scanf (“%d %d”,&m,&n);

printf (“Enter the coefficients of the matrix\n”);
for (i=0;i<m;++i)
{
for (j=0;j<n;++j)
{
scanf (“%d”,&ma[i][j]);
}
}
printf (“The given matrix is \n”);
for (i=0;i<m;++i)
{
for (j=0;j<n;++j)
{
printf (” %d”,ma[i][j]);
}
printf (“\n”);
}

printf (“Transpose of matrix is \n”);
for (j=0;j<n;++j)
{
for (i=0;i<m;++i)
{
printf (” %d”,ma[i][j]);
}
printf (“\n”);
}
}      /* End of main() */

/*——————————————
Output
Enter the order of the matrix
2 2
Enter the coefficients of the matrix
3 -1
6 0
The given matrix is
3 -1
6 0
Transpose of matrix is
3 6
-1 0

——————————————-*/

Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C program to read A (MxN), find the transpose of a given matrix and output both the input matrix and the transposed matrix.
  2. C program to accept a matrix of order MxN and find the trace and normal of a matrix HINT:Trace is defined as the sum of main diagonal elements and Normal is defined as square root of the sum of all the elements
  3. C program to accept a matrix of order M x N and find the sum of each row and each column of a matrix
  4. C program to read two matrices A (MxN) and B(MxN) and perform addition OR subtraction of A and B. Find the trace of the resultant matrix. Output the given matrix, their sum or Differences and the trace.
  5. C program to find accept a matrix of order M x N and find the sum of the main diagonal and off diagonal elements

Leave a Comment

{ 1 trackback }

Previous post:

Next post: