Warning! It seems that you are using Dodona within another webpage, so not everything may work properly. Let your teacher know so that he can solve the problem by adjusting a setting in the learning environment. In the meantime, you can click this link to open Dodona in a new window.
H8 arrays - Opwarmen - 2 dimensionale array declareren
Sign in to test your solution.
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;
}
}
}
You can submit as many times as you like. Only your latest submission will be taken into account.
Sign in to test your solution.