C Program – Find the transpose of a Matrix

by Nideesh C on April 18, 2011 · 0 comments

in C Programming




#include<stdio.h>
void main()
{
int A[5][5], B[5][5], i, j, m, n;
clrscr();
printf(“nnt ENTER A ORDER OF THE MATRIX M,N…: “);
scanf(“%d,%d”,&m,&n);
printf(“nnt ENTER THE ELEMENTS OF THE MATRIX..:nn”);
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
{
gotoxy(20+j*4,12+i*2);
scanf(“%d”,&A[i][j]);
}
printf(“n”);
}
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
B[j][i] = A[i][j];
printf(“nt THE TRANSPOSE OF A MATRIX IS…:nntt “);
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
printf(” %d”,B[i][j]);
printf(“nntt “);
}
getch();
}

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 its transpose
  3. 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.
  4. C program to accept a matrix of order M x N and find the sum of each row and each column of a matrix
  5. C program to accept a matrix and determine whether it is a sparse matrix. A sparse matrix is matrix which has more zero elements than nonzero elements

Leave a Comment

Previous post:

Next post: