fork download
  1. using static System.Console;
  2.  
  3. public class Program {
  4. public static void Main() {
  5. var array2D = new int[,] { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
  6. WriteLine(array2D[0, 0]);
  7. WriteLine(array2D[2, 1]); //2 (linha) * 3 (total de colunas + 1 (coluna) = 7
  8. var array1D = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
  9. WriteLine(array1D[0]);
  10. WriteLine(array1D[7]);
  11. for (int i = 0; i < array2D.GetLength(0); i++) {
  12. for (int j = 0; j < array2D.GetLength(1); j++) Write($"{array2D[i, j]} ");
  13. WriteLine();
  14. }
  15. for (int i = 0; i < array1D.Length; i++) Write($"{array1D[i]} "); }
  16. }
  17.  
  18. //https://pt.stackoverflow.com/q/397146/101
Success #stdin #stdout 0.01s 131520KB
stdin
Standard input is empty
stdout
1
8
1
8
1 2 3 
4 5 6 
7 8 9 
1 2 3 4 5 6 7 8 9