fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5.  
  6. public static void Main()
  7. {
  8. // your code goes here
  9. int[][] a = new int[5][];
  10. Array.Fill(a,new int[5]);
  11. printMatrix(a);
  12. a[1][2]=3;
  13. printMatrix(a);
  14. }
  15.  
  16. private static void printMatrix(int[][]arr)
  17. {
  18. for (int i = 0; i < arr.GetLength(0); i++)
  19. {
  20. for (int j = 0; j < arr[i].GetLength(0); j++)
  21. {
  22. Console.Write(arr[i][j]+" ");
  23. }
  24. Console.WriteLine();
  25. }
  26. Console.WriteLine();
  27. }
  28.  
  29. }
Success #stdin #stdout 0.02s 16032KB
stdin
Standard input is empty
stdout
0 0 0 0 0 
0 0 0 0 0 
0 0 0 0 0 
0 0 0 0 0 
0 0 0 0 0 

0 0 3 0 0 
0 0 3 0 0 
0 0 3 0 0 
0 0 3 0 0 
0 0 3 0 0