import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int count = scan.nextInt(); int[][] array = new int[count][count]; for(int i=0;i<count;i++) { for(int j= 0;j<count;j++) { array[j][i] = scan.nextInt(); } } for(int i=0;i<count;i++) { for(int j = 0;j<count;j++) { if(j<count-1) { System.out.print(array[i][j]+" "); }else { System.out.println(array[i][j]); } } } } } |
Double click to view unformatted code.