SHARE
TWEET

Untitled

a guest Oct 21st, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class fix {
  2.     public static void main(String[] args) {
  3.         int[][] b = {{3,4,5},{6,7,8}};
  4.         int temp;
  5.         int[][] transposedMatrix = new int[b[0].length][b.length];
  6.         for(int i = 0; i<b[0].length;i++){
  7.             for(int j = 0; j < b.length; j++)
  8.             {
  9.                 transposedMatrix[i][j] = b[j][i];
  10.             }
  11.         }
  12.         for (int i = 0; i < transposedMatrix.length; i++) {
  13.             for (int j = 0; j < transposedMatrix[i].length; j++) {
  14.                 System.out.print(transposedMatrix[i][j]);
  15.             }
  16.             System.out.println("");
  17.         }
  18.     }
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top