Untitled
unknown
csharp
a year ago
1.2 kB
5
Indexable
using System; namespace Methods { class Program { static int[,] GenerateArray(int rows, int columns) { int[,] array = new int[rows, columns]; Random rand = new Random(); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { array[i, j] = rand.Next(10); } } return array; } static void PrintArray(int[,] array) { int rows = array.GetLength(0); int columns = array.GetLength(1); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { Console.Write(array[i, j] + " "); } Console.WriteLine(); } } static void Main(string[] args) { int[,] myArray = GenerateArray(3, 4); Console.WriteLine("Array:"); PrintArray(myArray); } static void Procedure() { Console.WriteLine("Hello"); } } }
Editor is loading...
Leave a Comment