H8 arrays - Opwarmen - 2 dimensionale array declareren

Log in om je oplossingen te testen.
using System; namespace oefening { public class Program { public static void Main(string[] args) { //schrijf hieronder jouw code double[,] array = new double[3, 4]; Random random = new Random(); for (int i = 0; i < array.GetLength(0); i++) { for (int j = 0; j < array.GetLength(1); j++) { array[i, j] = random.NextDouble(); } } //==================== //hieronder niets aanpassen //==================== Console.WriteLine(PrintArray(array)); } //==================== //hieronder niets aanpassen //==================== public static string PrintArray(double[,] array) { //print the array in rows and columns string result = ""; for (int i = 0; i < array.GetLength(0); i++) { result += "["; for (int j = 0; j < array.GetLength(1); j++) { result += array[i, j] + " "; } result += "]\n"; } return result; } } }
Je kunt zo vaak indienen als je wenst. Er wordt enkel rekening gehouden met je laatst ingediende oplossing.
Log in om je oplossingen te testen.