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. // your code goes here
  13. int i,j;
  14. Scanner ob = new Scanner(System.in);
  15. int[][]mat =new int[3][3];
  16. for(i=0;i<3;i++){
  17. for(j =0;j<3;j++){
  18. mat[i][j] = ob.nextInt();
  19. }
  20. }
  21. System.out.println("The matrix is :");
  22. for(i=0;i<3;i++){
  23. System.out.println();
  24. for(j=0;j<3;j++){
  25. System.out.print(mat[i][j] +" ");
  26. }
  27. }
  28. }
  29. }
  30.  
  31.  
Success #stdin #stdout 0.16s 51900KB
stdin
1
2
3
4
5
6
7
8
9
0


9
9

99

9
9

9
9
9
9

9
9
9

9
9
9
9

9
9
9
9

9
9
9

9
9
9

9



stdout
The matrix is :

1 2 3 
4 5 6 
7 8 9