Bhuvan InfoTech Android App

Download our Android App and browse Technical News, Projects, Computer Tricks more easily with lots of Interesting Features.

Tuesday, June 14, 2016

Find transpose of matrix | C program

#include<stdio.h>
#include<conio.h> 
void main() 

  int arr[10][10], size, i, j, temp; 
   printf("\n Size of matrix :"); 
  scanf("%d", &size);   
 printf("\nEnter the values a:");   
for (i = 0; i < size; i++) {
      for (j = 0; j < size; j++) {
         scanf("%d", &arr[i][j]);  
    }
  }
    printf("\nGiven matrix is"); 
  for (i = 0; i < size; i++) {     
 printf("\n");      
for (j = 0; j < size; j++) {  
       printf("%d\t", arr[i][j]);      

  } 
   for (i = 1; i < size; i++) {  
    for (j = 0; j < i; j++) { 
        temp = arr[i][j];
         arr[i][j] = arr[j][i];   
      arr[j][i] = temp;   
   } 
  }
    printf("\nTranspose og given matrix is :");  
 for (i = 0; i < size; i++) {  
    printf("\n");  
    for (j = 0; j < size; j++) { 
        printf("%d\t", arr[i][j]); 
     }
   } 
   getch();
}
Bhuvan Arora

No comments:

Amazing Deal !