package codetraining;
import java.util.*;
public class Martix {
public static void main(String[] args) {
Scanner Keyboard = new Scanner(System.in);
int row = Keyboard.nextInt();
int column = Keyboard.nextInt();
int[][] a = new int[40][40];
int i,j;
while(Keyboard.hasNextInt()){
for( i=0; i<row ; i++ ){
for( j=0; j<column; j++){
a[i][j]=Keyboard.nextInt();
System.out.println("");
}
}
for( i=0; i<column ; i++ ){
for( j=0; j<row; j++){
System.out. print(a[j][i]+" ");
}
System.out.println("");
}
}
}
}
package codetraining;
import java.util.*;
public class Martix {
public static void main(String[] args) {
Scanner Keyboard = new Scanner(System.in);
int row = Keyboard.nextInt();
int column = Keyboard.nextInt();
int[][] a = new int[40][40];
int i,j;
while(Keyboard.hasNextInt()){
for( i=0; i for( j=0; j<column; j++){
a[i][j]=Keyboard.nextInt();
System.out.println("");
}
}
for( i=0; i for( j=0; j<row; j++){
System.out. print(a[j][i]+" ");
}
System.out.println("");
}
}
}
}
int[][] a = new int[40][40];
-> int[][] a = new int[row][column];