fork(3) 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) {
  11. int i, j, k;
  12. int[][] a = new int[3][5];
  13.  
  14. k=1;
  15. for (j=0;j<5;j++)
  16. {
  17. for (i=0;i<3;i++)
  18. {
  19. a[i][j]=k;
  20. k++;
  21. }
  22. }
  23.  
  24. for (i=0;i<3;i++)
  25. {
  26. for (j=0;j<5;j++)
  27. {
  28. System.out.print(a[i][j]+" ");
  29. }
  30. System.out.println();
  31. }
  32. }
  33. }
Success #stdin #stdout 0.09s 27796KB
stdin
Standard input is empty
stdout
1 4 7 10 13 
2 5 8 11 14 
3 6 9 12 15