C program to find Transpose of Matrix.

This blog has been migrated to learn c programming for beginners


Write a C program to find Transpose of Matrix 

This C program prints the Transpose of supplied Matrix.

C Program source code

#include<stdio.h>
#include<conio.h>
#define MAX 100
int main()
{
 int i,j,r,c,m[MAX][MAX];
 printf("Enter the order of matrix:\n");
 scanf("%d%d",&c,&r);
 printf("Enter a %d*%d matrix:\n",c,r);
 for(i=0;i<c;i++)
 {
  for(j=0;j<r;j++)
  {
   scanf("%d",&m[i][j]);
  }
 }
 printf("Matrix before transpose:\n");
 for(i=0;i<c;i++)
 {
  for(j=0;j<r;j++)
  {
   printf("%d\t",m[i][j]);
  }
  printf("\n");
 }
 printf("Matrix after transpose:\n");
 for(j=0;j<r;j++)
 {
  for(i=0;i<c;i++)
  {
   printf("%d\t",m[i][j]);
  }
  printf("\n");
 }
 getch();
 return(0);
}
 
You can Browse related article below for more information and program code related to different math operation.   Does above is helpful , Post you views in comment    

DO NOT MISS OTHER C PROGRAMMING TUTORIAL

* indicates required



C program to find Transpose of matrix



Comments

Popular posts from this blog

Copy Constructor

Print pattern in c - explore new perspectives in pattern printing

C program to check if the supplied year is leap year or not.