fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner scan = new Scanner(System.in);
  13. int r = scan.nextInt();
  14. int c = scan.nextInt();
  15. int[][] a = new int[r][c];
  16. for(int i=0;i<r;i++){
  17. for(int j=0;j<c;j++){
  18. a[i][j] = scan.nextInt();
  19. }
  20. }
  21. for(int i=0;i<r;i++){
  22. for(int j=0;j<c;j++){
  23. System.out.print(a[i][j]+" ");
  24. }
  25. }
  26. }
  27. }
Success #stdin #stdout 0.14s 58956KB
stdin
3 3 
1 2 3
7 8 9
4 5 6
stdout
1 2 3 7 8 9 4 5 6