Answers for "Display the transpose of a given matrix java"

2

in place transpose in a matrix in java

  //Transpose a Matrix

  for (int row = 0; row < matrix.length; row++) {
    
   for (int col = row; row < matrix[row].length; col++) 
   {
    	// Swap 
     	int data = matrix[row][col];
    	matrix[row][col] = matrix[col][row];
   		matrix[col][row] = data;
   }
  
  }
Posted by: Guest on October-27-2020
0

transpose of a matrix java

for (int row = 0; row < matrix.length; row++) {
    
   for (int col = row; col < matrix[row].length; col++) 
   {
    	// Swap 
     	int data = matrix[row][col];
    	matrix[row][col] = matrix[col][row];
   		matrix[col][row] = data;
   }
  
  }
Posted by: Guest on November-14-2020

Code answers related to "Display the transpose of a given matrix java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language